Compare JavaScript performance, execution speed, and ops/sec between multiple code snippets directly in your browser.
Loading tool
About Benchmark Builder
Compare the speed of JavaScript snippets in your browser. Write a shared setup block and any number of named snippets; each runs in a Web Worker, first calibrated into batches and then timed with performance.now() for a time budget (250 ms to 5 s) or a fixed number of iterations. Results show operations per second, mean time per run, relative margin of error at 95% confidence, total runs and speed relative to the fastest snippet. Code runs locally via new Function, so only run code you trust.
Common uses
- Compare for, for...of and reduce on the same data
- Check whether a micro-optimization actually makes a difference
- Measure the cost of a regex, JSON.parse or string-building approach
- Share a quick performance comparison with a teammate
FAQ
- How accurate are browser micro-benchmarks?
- They are indicative. JIT compilation, garbage collection, dead-code elimination and CPU throttling all affect results, so differences under a few percent or within the margin of error are usually noise. Run several times and test on the browsers you target.
- What does the plus-minus percentage mean?
- It is the relative margin of error: 1.96 times the standard error of the sample means, divided by the mean. Smaller is more reliable.
- Why does my snippet need to use its result?
- If a computation's result is never used, the engine may optimize part of it away and report unrealistically fast times. Assigning or returning the result reduces that risk.
- Can the benchmark access the page or DOM?
- No. Snippets run inside a Web Worker, which has no DOM access, so DOM operations cannot be benchmarked here.