Add Vitest bench adapter#889
Conversation
🤖 Claude Code ReviewPR: #889 I have a thorough understanding of the changes. Here's my review. PR Review: Add Vitest bench adapterOverall this is a high-quality, well-tested, and well-documented change. It faithfully follows existing conventions (closely modeled on Strengths
Issues / discussion points
Compliance with CLAUDE.md
One verification gap: I couldn't run Net: solid, mergeable work. I'd consider addressing #1 (graceful per-benchmark name handling) before merge; #2–#4 are optional follow-ups. Model: claude-opus-4-8 |
|
| Branch | u/ep/js-vitest-adapter |
| Testbed | intel-v1 |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result microseconds (µs) (Result Δ%) | Upper Boundary microseconds (µs) (Limit %) |
|---|---|---|---|
| Adapter::Json | 📈 view plot 🚷 view threshold | 4.68 µs(+2.15%)Baseline: 4.59 µs | 4.82 µs (97.12%) |
| Adapter::Magic (JSON) | 📈 view plot 🚷 view threshold | 4.55 µs(+1.97%)Baseline: 4.47 µs | 4.68 µs (97.37%) |
| Adapter::Magic (Rust) | 📈 view plot 🚷 view threshold | 25.96 µs(+2.03%)Baseline: 25.45 µs | 26.42 µs (98.27%) |
| Adapter::Rust | 📈 view plot 🚷 view threshold | 3.53 µs(+1.82%)Baseline: 3.47 µs | 3.59 µs (98.48%) |
| Adapter::RustBench | 📈 view plot 🚷 view threshold | 3.53 µs(+1.78%)Baseline: 3.47 µs | 3.58 µs (98.62%) |
ee35821 to
581178d
Compare
581178d to
753065c
Compare
Add a `js_vitest` benchmark adapter that parses `vitest bench --outputJson` output. Each benchmark reports both a `latency` measure (mean by default, or median via `--average`) and a `throughput` measure (operations per second). For the mean, the latency bounds come from the standard deviation; the median has no bounds because Vitest does not provide an interquartile range. The throughput bounds come from the relative margin of error. The benchmark name joins the suite `fullName` and the benchmark `name`. Wire `js_vitest` through the `Adapter` enum, the CLI, magic auto-detection, the console UI, and the adapters documentation in all nine languages.
753065c to
f84b2d3
Compare
Closes #215.
Adds a
js_vitestbenchmark adapter that parses the JSON produced byvitest bench --outputJson <file>(verified against Vitest v3.0.5 + tinybench v2.9.0).Measures
Each benchmark reports both built-in measures:
meanby default, ormedianvia--average. For the mean,lower_value/upper_valueare one standard deviation around the value. The median has no bounds, since Vitest provides no interquartile range.hz, withlower_value/upper_valuederived from the relative margin of error (rme), matching the existingjs_benchmarkadapter.Benchmark names
Names join the suite
fullNameand the benchmarknamewith Vitest's own>separator (e.g.math > fibonacci > fib(10)), falling back to the leaf name when the suite name is empty or the combined name would exceed the length limit. The absolutefilepathis excluded since it is not portable across CI machines.Usage
bencher run --adapter js_vitest --file results.json "vitest bench --run --outputJson results.json"Scope
AdapterJsVitestplus anew_measuresconstructor for multi-measure results; wired into the JS chain, the dispatch table, and magic auto-detection.Adapter::JsVitestenum variant (withDisplayand the SQL impls), CLI--adapter js_vitest, and regeneratedopenapi.json+bencher.ts.js-vitestchunk, amagiclist entry, and theadapterspage render across all nine languages. The non-English chunks currently carry the English copy as a placeholder for later translation.Tests
cargo nextest,cargo clippy --no-deps --all-targets --all-features -- -Dwarnings,cargo test --doc, andcargo check --no-default-featuresall pass;biomeis clean; a fullastro buildrenders the Vitest docs in every language.