Skip to content

bench: add length benchmark to buffer/reviver - #15151

Merged
kgryte merged 2 commits into
developfrom
claude/busy-mayer-l1dapx
Sep 10, 2026
Merged

bench: add length benchmark to buffer/reviver#15151
kgryte merged 2 commits into
developfrom
claude/busy-mayer-l1dapx

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request adds a missing length-scaling benchmark to @stdlib/buffer/reviver, restoring parity with the rest of the buffer namespace.

Namespace summary. The buffer namespace has 8 non-generated members: alloc-unsafe, ctor, from-array, from-arraybuffer, from-buffer, from-string, reviver, and to-json. Structural features (file tree, package.json/manifest shape, 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, the package.json key 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), value return kind (8/8), and @example presence (8/8). Features without a clear majority (excluded from correction): README section ordering (package-specific Notes/Properties/Methods blocks), public signature and validation prologue (genuinely per-function), and lib/polyfill.js/test/test.polyfill.js presence (6/8 — only packages wrapping native Buffer APIs carry a polyfill).

The sole surviving, high-signal drift correction targets one outlier package.

@stdlib/buffer/reviver

Adds benchmark/benchmark.length.js to @stdlib/buffer/reviver, the only member of the buffer namespace lacking one (present in 7/8, 87.5%). The reviver's cost scales with the data array 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 same createBenchmark(len) factory as the sibling to-json benchmark. No changes to source, public API, tests, or examples.

Related Issues

Does this pull request have any related issues?

None.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

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.js as unintentional drift rather than a justified deviation. The revive path was verified locally: reviving a length-n data array yields a Buffer of length n.

Deliberately excluded from this PR:

  • Absence of lib/polyfill.js / test/test.polyfill.js in reviver and to-json — intentional, as these pure-JS packages wrap no native Buffer API to polyfill.
  • The errorConstruction deviation in ctor and reviver — both throw no errors, so there is nothing to normalize to format.
  • All features without a clear 75% majority (README section order, per-function signatures, and validation prologues).

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution.

This PR was authored by Claude Code (Claude Opus 4.8) running an automated cross-package drift-detection routine over the buffer namespace. 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

@stdlib-bot

stdlib-bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
buffer/reviver $\\color{green}101/101$
$\\color{green}+0.00\\%$
$\\color{green}7/7$
$\\color{green}+0.00\\%$
$\\color{green}1/1$
$\\color{green}+0.00\\%$
$\\color{green}101/101$
$\\color{green}+0.00\\%$

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
Planeshifter force-pushed the claude/busy-mayer-l1dapx branch from 0a04119 to 47d3fba Compare September 10, 2026 20:24
@kgryte kgryte added the Benchmarks Pull requests adding or improving benchmarks for measuring performance. label Sep 10, 2026
@kgryte
kgryte marked this pull request as ready for review September 10, 2026 20:43
@kgryte
kgryte requested a review from a team September 10, 2026 20:43
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Sep 10, 2026
Signed-off-by: Athan <kgryte@gmail.com>
@kgryte
kgryte merged commit 1cd8244 into develop Sep 10, 2026
14 checks passed
@kgryte
kgryte deleted the claude/busy-mayer-l1dapx branch September 10, 2026 20:48
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Benchmarks Pull requests adding or improving benchmarks for measuring performance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants