bench: add length benchmark to buffer/reviver - #15151
Merged
Merged
Conversation
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
Add a missing `benchmark/benchmark.length.js` to the `buffer/reviver` package. A length-scaling benchmark is present in 7 of 8 (87.5%) sibling packages in the `buffer` namespace; `reviver` was the sole member lacking one. The reviver's revive path constructs a `Buffer` from a data array via `buffer/from-array`, so its runtime scales with the input data-array length, making a length benchmark meaningful and consistent with siblings such as `buffer/to-json`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018dMN9GA3gkkmq4yzQdBKh4
Planeshifter
force-pushed
the
claude/busy-mayer-l1dapx
branch
from
September 10, 2026 20:24
0a04119 to
47d3fba
Compare
kgryte
marked this pull request as ready for review
September 10, 2026 20:43
Signed-off-by: Athan <kgryte@gmail.com>
kgryte
approved these changes
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request adds a missing length-scaling benchmark to
@stdlib/buffer/reviver, restoring parity with the rest of thebuffernamespace.Namespace summary. The
buffernamespace has 8 non-generated members:alloc-unsafe,ctor,from-array,from-arraybuffer,from-buffer,from-string,reviver, andto-json. Structural features (file tree,package.json/manifestshape, README section list, and test/benchmark/example file naming) and semantic features (public signature, validation prologue, error construction, return kind, JSDoc shape, and source dependencies) were extracted per package and compared against a 75% majority threshold (≥6/8). Features with a clear majority: the standard file tree, thepackage.jsonkey set (8/8),benchmark/benchmark.js(8/8),benchmark/benchmark.length.js(7/8),format-based error construction among the packages that throw (6/6),valuereturn kind (8/8), and@examplepresence (8/8). Features without a clear majority (excluded from correction): README section ordering (package-specificNotes/Properties/Methodsblocks), public signature and validation prologue (genuinely per-function), andlib/polyfill.js/test/test.polyfill.jspresence (6/8 — only packages wrapping nativeBufferAPIs carry a polyfill).The sole surviving, high-signal drift correction targets one outlier package.
@stdlib/buffer/reviverAdds
benchmark/benchmark.length.jsto@stdlib/buffer/reviver, the only member of thebuffernamespace lacking one (present in 7/8, 87.5%). The reviver's cost scales with thedataarray it hands to@stdlib/buffer/from-array, so the benchmark parses{"type":"Buffer","data":[...]}JSON via the reviver across lengths 10^1 through 10^6, using the samecreateBenchmark(len)factory as the siblingto-jsonbenchmark. No changes to source, public API, tests, or examples.Related Issues
None.
Questions
No.
Other
Validation. Structural features were extracted directly from the filesystem; semantic features were extracted with one agent per package. The candidate correction passed a three-agent drift validation — semantic review of applicability, cross-reference of tests/examples and documented contracts, and structural review of the majority pattern — with all three confirming the missing
benchmark.length.jsas unintentional drift rather than a justified deviation. The revive path was verified locally: reviving a length-ndataarray yields aBufferof lengthn.Deliberately excluded from this PR:
lib/polyfill.js/test/test.polyfill.jsinreviverandto-json— intentional, as these pure-JS packages wrap no nativeBufferAPI to polyfill.errorConstructiondeviation inctorandreviver— both throw no errors, so there is nothing to normalize toformat.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code (Claude Opus 4.8) running an automated cross-package drift-detection routine over the
buffernamespace. The routine extracted structural and semantic features per package, computed per-feature majority patterns, validated the single surviving outlier through multiple review agents, and generated the new benchmark file from the established sibling scaffold. The benchmark's correctness was verified locally before committing.@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_018dMN9GA3gkkmq4yzQdBKh4
Generated by Claude Code