Benchmark Builder
Build and run JavaScript performance benchmarks in your browser. Compare code snippets and measure ops/sec. Free, private, browser-based.
Local processing⚠ Security notice: This tool executes the JavaScript you paste below directly in your browser. Only benchmark code you trust. Do not paste code from untrusted sources.
What is Benchmark Builder?
A JavaScript benchmark measures how fast a code snippet executes by running it repeatedly and counting operations per second (ops/sec). Comparing multiple snippets reveals which approach is faster.
How It Works
Each snippet is compiled into a function via the Function constructor. The function is called in a tight loop for ~1 second. The iteration count divided by elapsed time gives ops/sec. A warmup phase primes the JIT compiler.
Common Use Cases
- Comparing algorithm implementations
- Measuring string/array operation performance
- Optimizing hot code paths
Technical Details
Uses new Function() to compile snippets. Warmup: 1000 iterations. Measurement: loop until 1 second elapsed or 10M iterations. Reports ops/sec, total time, and relative speedup. Uses performance.now() for timing.
How to Use
- Enter one or more JS code snippets
- Click Run Benchmark
- Compare ops/sec results
Privacy
All processing happens in your browser. Your data is never uploaded to any server.
FAQ
How does the benchmark work?
Each code snippet is executed in a loop for a fixed duration. The tool counts completed iterations and reports operations per second. Results are compared side by side.
Is it safe to run arbitrary JS?
Code runs in a sandboxed Function constructor with no access to your page's scope. However, avoid running untrusted code.