Repository navigation
chore: add a self-contained benchmark harness - #123
Merged
Merged
Conversation
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.
Adds a self-contained, reproducible throughput benchmark harness under
benchmarks/, plus the optional comparison libraries, npm scripts, and docs.What's included
benchmarks/bench.js— head-to-head encode/decode vsmsgpackr,msgpack-lite,@msgpack/msgpack, and JSON, across the generated datasets. Each function runs under a fixed wall-clock budget (default 4000 ms, overrideBENCH_MS), reports ops/sec and ratios relative to msgpack5, and verifies every round-trip against the source JSON. Missing comparison libraries are skipped.benchmarks/stream.js— streaming.decoder()throughput vs msgpackr'sUnpackrStream.benchmarks/ab.js— A/B harness comparing two local msgpack5 checkouts viaAB_OLD/AB_NEW(interleaved rounds, median ops/sec, new/old ratio).benchmarks/gen-data.js— deterministic generator for the datasets (sample-large,example4,example5,mixed), written to the git-ignoredbenchmarks/data/.benchmarks/data/is git-ignored (generated on demand bygen-data.js/bench.js).npm run bench,bench:stream,bench:ab,bench:genscripts; README "Benchmarks" section; AGENTS.md updated (decoder description and benchmark commands).The existing
benchmarks/encodedecode.js/parseshortmap.jsare left as-is.Notes
benchmarks/is linted bystandardas part ofnpm test; the new scripts follow the existing project style. All 4391 tests still pass on Node 22/24/26.bench:ab) just pointsAB_OLD/AB_NEWat two checkouts, so it works with any two local builds (no sandbox/symlink setup required).msgpackr-extractis an optional native dependency; if it can't be built, msgpackr still loads (pure-JS fallback) and the harness keeps working.