Using jsPerf correctly
summary
jsPerf shows about 68% broken tests and adds roughly 57 new test cases per day, so expect noise not answers. Benchmarks rely on Benchmark.js and BrowserScope for timing and storage; common failures are declaring functions inside the timed body, leaking or not resetting globals, using randomness, testing async code synchronously, and not testing all target engines. Good tests put helpers in preparation/setup/teardown, use Benchmark.js advanced APIs, avoid randomness, and account for plugins and timer granularity.
AI-written summary · about
chapters (19)
- 0:00Intro
- 2:39Statistics
- 3:45Benchmarking pitfalls
- 5:53Test in all browsers
- 6:14The 6 bullet points
- 6:51Common problems with tests
- 8:02Running tests
- 8:53Comparing methods
- 9:56Test case example
- 11:14Reset variables
- 12:25Test rerun
- 12:52Test randomness
- 13:29Never just asynchronous
- 14:29synchronous tests
- 16:48multi test case
- 17:54dumb cleanup
- 19:59benchmarkjs
- 20:26testcount
- 21:21unexpected browser features








