JS javascript · a worked example

autor3search-javascript demo: −54.00% on code written slow on purpose

FIXTURE not a third-party library
HEADLINE
−54.00%
own demo code, written slow on purpose

before → after

bar length is relative to the before value
countWords ns/op−54.00%
before
168,105
after
77,333

what changed

A word counter with a regex per character and string concatenation. Charcode comparisons and a Map replaced them.

1 experiment

1
kept
0
discarded
0
failed

note — the test and the benchmark are restored before every eval, so the behaviour had to survive the change to be scored. On a busier machine, this same diff can land as a DISCARD.

how it was measured

tool
vitest bench
rounds
interleaved rounds per side
verdict rule
KEEP needs no tripped regression guard, a score below 0.99, and one benchmark past a Bonferroni-corrected significance bar.

LIMITS

Results hold only for the benchmarks a run measures. Inputs they do not cover can get slower. Check your hot paths before you merge.