PERFORMANCE

Algorithm Benchmark Runner

Paste two JavaScript implementations of the same algorithm, pick a seeded input, and measure both in this tab. The runner reports wall-clock statistics, a deterministic array-access count, and — if you turn it on — a growth exponent fitted from a size ladder.

Your code runs in this tab and the page reports what actually happened; nothing is uploaded and nothing is stored. Timings are this-tab-only and are not comparable across machines, browsers, or tabs under different load. The growth exponent is fitted from measured points at the sizes you chose — it is evidence, not a proof of Big-O. The array-op count only sees indexed access on the array handed to your function, so a function that copies the array first goes blind after the copy. This page cannot interrupt a non-terminating function: if your code loops forever, the tab will hang until you close it.

1 · Implementations

Each snippet must define solution(data) and return a number. The input array is passed as the argument data; a global alias input points at the same array so the example snippets run unchanged. Both lanes are compiled through the new Function constructor, in this tab only.

2 · Input and controls

Budget: each timed sample is capped at roughly 2000 ms. If a single call is slower than that, the runner stops that lane, tells you the size/iteration combination is too large, and keeps whatever partial results it already collected. Iterations are raised automatically when one call is too fast for the timer to resolve; the effective count is shown in the results. Pressing Run again while a run is in flight discards the older run's output.

3 · Results

No run yet. Press Run benchmark to measure in this tab.