Benchmark Builder
Time candidates by hand or with a built-in stopwatch, compare median / mean / min / max / std dev, and copy a ready-to-paste markdown table.
Examples
String building shootout
Array join [1.2, 1.4, 1.3, 1.1, 1.5 ms] vs + concat [2.9, 3.1, 2.8, 3.0, 3.2 ms]| Array join | 5 | 1.3 ms | 1.3 ms | 1.1 ms | 1.5 ms | 0.16 ms |Five runs per candidate are enough for a clear median gap; the small std dev says the ranking is stable, not luck.
Stopwatch session
Start → run snippet → Stop, repeated to the 10-run targetmedian/mean/min/max/std dev update after every captureEach stopwatch capture lands as one run via performance.now(); the progress readout shows runs against the repeats target.
PR evidence table
Two candidates, 10 runs each, sorted by medianmarkdown table copied into the pull request descriptionReviewers see the medians and spreads behind the claim without rerunning anything.
About this tool
A performance claim without a table behind it is just an opinion. The Benchmark Builder structures the whole measuring exercise: you list the candidates you want to compare — two implementations, two configuration options, a before and an after — then record run durations for each one, either by typing measurements in by hand or with the embedded stopwatch that reads performance.now() at sub-millisecond resolution. When you stop the timer, the elapsed time lands as one run for that candidate, and you repeat until you reach the target run count you set up front.
From those runs the tool computes the statistics that actually describe a benchmark: median, mean, minimum, maximum and the sample standard deviation. The median is the default sort and deserves its status — timing distributions are right-skewed, pocked by garbage-collection pauses and scheduler hiccups, so the mean is dragged upward by a few unlucky runs while the median reports what a typical run feels like. The standard deviation tells you whether a candidate is consistently fast or just occasionally lucky; a 2 ms median with a 9 ms spread loses to a stable 3 ms in anything user-facing.
The results table ranks candidates fastest-first with a badge on the best median, and the same numbers emit as a markdown table — candidate, runs, median, mean, min, max, std dev — that copies straight into a pull request, README, or issue, so a performance claim ships with its evidence. Units scale automatically from nanoseconds to seconds, and sorting can switch to mean, best run, worst run or alphabetical order when the comparison calls for it.
Everything runs and stays on your device: measurements are taken and computed in your browser, nothing is uploaded, and the whole session — candidates, labels, run lists and sort choice — persists locally so you can close the tab mid-experiment and resume. If you also need to show how the code itself changed between candidates, the Code Diff Patch Generator pairs naturally with this tool; and when a timing gap turns out to be a serialized-payload problem, the JSON Diff helps you compare what the two versions actually produce.
What this tool does not do
- The stopwatch measures wall-clock time from this device's clock — it cannot profile inside your code; run snippets elsewhere and record their durations.
- Measurements reflect this machine and browser session only; they are comparative evidence, not transferable absolute numbers.
- Statistics stop at descriptive summaries — there is no significance testing; for formal claims, collect many runs and apply a proper test.
How to use this tool
Add the candidates
Create one entry per implementation or configuration you are comparing, and give each a label that will read clearly in the table.
Record the runs
Type durations manually (comma or newline separated milliseconds) or use the stopwatch: start, run your code, stop — each capture is one run. Aim for the repeats target.
Compare the statistics
Read median first (typical run), then std dev (consistency) and min/max (spread). Switch the sort to mean, best or worst run when the question demands it.
Copy the markdown table
Use Copy markdown to paste the candidate × statistics table into your PR, README or issue so the numbers travel with the claim.
Use cases
Choosing between implementations
Compare two loops, parsers or serialization strategies on real workloads and pick by median and consistency instead of a single lucky run.
Verifying a performance fix
Record runs for the old code and the patched code, then paste the markdown table into the PR as measurable before/after evidence.
Classroom-style measurement practice
Demonstrate why median beats mean on skewed timing distributions and how sample size changes the spread — with numbers students collect themselves.
The five statistics and when to trust them
| Statistic | What it tells you |
|---|---|
| Median | The typical run — robust against GC pauses and outlier spikes |
| Mean | Total cost per run — honest when every run matters, skewed by outliers |
| Min | The machine's best-case ceiling for this candidate |
| Max | Worst observed run — the tail users sometimes hit |
| Std dev | Consistency: small means predictable, large means noisy or bimodal |
| Runs | Sample size — more runs narrow the spread and steady the median |
Std dev uses the sample formula (n−1 denominator); a single run reports 0 rather than an undefined value.
Common mistakes
Mistake:Judging by a single run.
Fix:One measurement is an anecdote — a GC pause can triple it. Record several runs toward the repeats target and compare medians; the tool's per-candidate run counts keep you honest.
Mistake:Trusting the mean on skewed timing data.
Fix:Timing distributions have a long right tail, so a few outliers drag the mean above what users typically experience. Read the median first, use std dev to check the spread, and treat a mean far above the median as an outlier warning.
Mistake:Benchmarking without warm-up and comparing cold starts.
Fix:First runs pay JIT compilation and cache costs. Throw away or discount obvious cold-start outliers, warm the code up before recording, and keep every candidate's measurement conditions identical.
Frequently asked questions
Why is the median preferred over the mean for benchmarks?
Timing data is right-skewed: garbage-collection pauses, JIT recompilation and OS scheduling inject occasional long runs, and the mean chases those outliers upward while the median ignores them. The median answers "how long does a typical run take", which is usually the question a benchmark is really asking. That is why the builder sorts by median by default and badges the best median — use the mean column to detect when the distribution is being dragged (mean well above median is an outlier warning), not as the primary ranking.
How many runs do I need per candidate?
More runs steady the median and shrink the standard deviation, but returns diminish after roughly 10–30 runs for most quick comparisons. The builder's repeats target makes the sample size explicit per candidate, and the Runs column in the results table shows exactly how many measurements back each row. If two candidates' medians are close, increase the run count before concluding anything — with few samples the ranking can flip on a single lucky or unlucky capture.
Should I warm up code before benchmarking?
Yes. First executions pay one-time costs — JIT compilation, inline caching, lazy imports — so cold runs overstate steady-state latency. Warm the code up before recording, discard obviously anomalous first captures, and keep conditions identical across candidates: same machine state, same input data, same browser tab. The tool makes this easy to follow because every capture is recorded individually — you can see a cold-start outlier sitting above the rest of a candidate's runs.
How does the embedded stopwatch measure time?
It uses performance.now(), the browser's monotonic high-resolution clock, capturing the elapsed time between Start and Stop with sub-millisecond precision — far better suited than Date.now() because it is not affected by system clock adjustments. Each stop lands as one run for that candidate in milliseconds. The stopwatch measures wall-clock time only: run the code you want to time elsewhere while it is recording, which also keeps the measurement loop itself out of the way of the tool page.
What does the standard deviation tell me in a benchmark?
It quantifies consistency. A candidate with a 2 ms median and a 0.1 ms standard deviation behaves predictably, while a 2 ms median with a 9 ms standard deviation is erratic — some users will hit the bad tail. Large deviations can also signal a bimodal distribution, for example fast runs when the JIT optimizes and slow ones before it does. The builder uses the sample standard deviation (n−1 denominator) and reports 0 for a single run rather than an undefined value.
Can I use these numbers in documentation or a paper?
For a pull request, README or issue, yes — that is exactly what the markdown table is for, and it keeps the claim honest by showing runs, spread and the sort basis. For formal research, treat the output as raw material: the numbers describe this machine, this browser and this session, so state the environment, collect many runs, and apply proper statistical tests rather than relying on descriptive statistics alone. Never compare numbers measured on different machines or in different sessions.
References & standards
Related tools
Precision Stopwatch
Measure drift-free elapsed time and compare lap splits using performance.now.
LLM Benchmarks
Compare LLM coding, reasoning, speed and cost benchmarks side-by-side and get a task-specific model recommendation
Big-O Complexity Comparator
Compare algorithm complexity growth curves and operation counts entirely in your browser.