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.

Ready to benchmark.

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.

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.

Embed this tool

Copy the code below to embed this tool on your site. It auto-resizes and works cross-origin.

<iframe
  src="https://appdoesit.com/apps/benchmark-builder?embed=1"
  title="Benchmark Builder"
  style="width:100%;min-height:320px;border:0;"
  loading="lazy"
></iframe>
<script>
  var iframe = document.querySelector('iframe[src*="embed=1"]');
  window.addEventListener('message', function (e) {
    if (!e.data || e.data.type !== 'appdoesit:resize') return;
    if (!Number.isFinite(e.data.height)) return;
    iframe.style.height = e.data.height + 'px';
  });
</script>

The iframe auto-adjusts its height via postMessage — include the parent script in the snippet.