Benchmark Builder
Create JavaScript benchmark cases, tune warmup and iterations, and compare browser-run performance side by side.
Use this when you have made a change and want browser-run evidence that it is actually faster, not just faster in your head. Benchmark Builder lets you write small JavaScript cases, tune warmup and iteration counts, and run them side by side so you can compare implementation strategies with the same test. It is built for validating an optimization claim before you commit it, for A/B-ing two approaches such as a new data structure or a rewritten loop, and for producing the numbers you would paste into a pull-request description. The runs happen in your browser on your hardware, so the relative comparison is meaningful on your machine; absolute numbers will not match another machine's. No code or result leaves the page — everything is processed in your browser and never uploaded.
What Is Benchmark Builder?
Benchmark Builder is a free JavaScript micro-benchmark runner. You write up to 50 cases, it runs each one in a Web Worker in your browser, and you get ops/sec, average ns per op and total ms for every case. Your code runs on your device and is not uploaded :)
Benchmark settings
How many measured runs each case should execute. Higher values usually produce steadier numbers.
How many runs to execute before measurement to let the JavaScript engine settle.
Your benchmark code runs only in this browser and is not uploaded, but saved cases and settings stay in local storage until you clear them.
Benchmark cases
Benchmark results
Run a benchmark to populate the comparison table.
| Notes |
|---|
How Benchmark Builder Works
Each case is compiled once with new Function() and gets its own state object that persists between calls. The worker runs your warmup calls first (default 1,000), then times your iterations (default 100,000) in chunks of 2,000, so Stop and the progress bar stay responsive. Cases run one after another, never in parallel. Everything inside your snippet is timed, including setup. Formulas: avg ns/op = total ms x 1,000,000 / iterations, and ops/sec = iterations / (total ms / 1000). Iterations take 1 to 100,000,000 and warmup takes 0 to 100,000,000. The fastest case is the one with the highest ops/sec, and the CSV export has 6 columns: case, ops_per_sec, avg_ns_per_op, total_ms, error_type, error_message.
Worked Examples
- Say 100,000 iterations finish in 250 ms. Avg ns/op = 250 x 1,000,000 / 100,000 = 2,500 ns, and ops/sec = 100,000 / 0.25 = 400,000.
- Say 100,000 iterations finish in 0.8 ms. That is 8 ns per op and 125,000,000 ops/sec. Anything under 1 ms gets a note asking for more iterations, so try 1,000,000 for a steadier reading.
- Load example gives you 3 cases (Array map, for loop, forEach) that each double the same 1,000 numbers. The last doubled value is 1,998, and the for loop and forEach cases add up all 1,000 doubled values to 999,000. Same work, 3 strategies, so the ops/sec gap is the strategy and not the task.
When to use Benchmark Builder
Benchmark Builder is useful when you need fast, repeatable browser-side comparisons:
-
Compare implementation strategies
Measure two or more JavaScript snippets side by side before choosing one for production code.
-
Validate an optimisation claim
Check whether a refactor or micro-optimisation actually improves throughput before shipping it.
-
Prepare benchmark evidence for a PR
Copy the summary or export CSV results to support a pull request, issue, or architecture discussion.
-
Tune warmup and iteration settings
Increase warmup or iterations to reduce noise and get more stable results for sensitive benchmarks.
-
Resume saved benchmark work
Come back after a reload and continue working with the same saved cases and settings from local storage.
Benchmark Builder vs CPU Benchmark
Benchmark Builder measures your code. You pick the snippets, the iterations (1 to 100,000,000) and the warmup, and you compare cases on one machine. It tells you which approach is faster here, not how fast the machine is.
To measure the machine, use the CPU Benchmark. It runs 6 fixed Wasm workloads and gives a normalized score where a reference-class desktop reads around 1000, so scores stay comparable over time.
Frequently asked questions
-
Does Benchmark Builder store my benchmark cases?
Yes. The app stores your benchmark cases plus iteration and warmup settings locally in this browser under benchmarkBuilder.state.v1 so they return after reload.
-
Is any of my benchmark data sent to a server?
No. Benchmark Builder runs locally in your browser and does not send your code or settings to a server.
-
What exactly is restored after I reload the page?
The saved cases, iteration count, and warmup count are restored from local storage so you can continue where you left off.
-
How do I delete saved benchmark data?
Clear this site's browser storage or remove the saved AppDoesIt site data in your browser settings to delete the stored benchmark state.
-
Why do results change between runs?
Small performance differences are normal. Use consistent inputs, increase iterations or warmup, and compare multiple runs before drawing conclusions.
Benchmark Builder Help
Benchmark Builder runs your JavaScript snippets locally in a Web Worker so you can compare approaches without sending code to a server.
How to run a benchmark
- Add or rename cases, then paste the JavaScript snippet you want to measure for each one.
- Set the iteration count and warmup rounds. These settings, along with your cases, are saved in this browser under benchmarkBuilder.state.v1 and restored after reload.
- Run the benchmark, review the results table, then copy or download the results when you need to share them.
What the app does
- Runs each case in a dedicated Web Worker so the main page stays responsive.
- Compares ops/sec, average nanoseconds per operation, total runtime, and notes for each case.
- Stores your benchmark cases, iterations, and warmup locally in this browser only; nothing is sent to a server.
- Lets you remove saved benchmark data by clearing this browser's site storage for AppDoesIt.
Benchmark tips
- Keep each case focused on one operation so the comparison stays meaningful.
- Increase warmup when you want to reduce noise from JIT compilation.
- Use the same input size and setup for every case to keep results fair.
- Avoid benchmarking untrusted code, because the snippets still run inside your browser.