📝 Benchmark Benchmark
Build and run small JavaScript benchmarks in your browser — compare snippets with real timings.
📐 工作原理與說明
Throughput = operations × 1000 ÷ elapsed ms (ops/s); workloads: int 500 square-add loops, float trig/sqrt, str 100 concatenations, array push 200 items and sort, object write 200 keys. One operation differs by workload; the page shows raw elapsed time and ops/s only, with no cross-workload grading. Timing includes chunk scheduling but excludes the 30 ms start delay and optional warm-up.
對多個候選實現做可復現的效能對比,輸出統計指標。
- 取樣:每個候選重複執行 N 次,記錄耗時,統計均值、中位數、標準差與百分位。
- 預熱:先跑若干輪 warmup 讓 JIT 完成最佳化再正式計時,避免冷啟動偏差。
- 計時:用
performance.now()(單調高精度時鐘)而非Date.now()。 - 干擾:瀏覽器後臺節流、GC 停頓與其他標籤頁負載都會汙染結果,應多輪取穩定值。
負載型別:
時長
預熱
執行耗時
—
運算次數
—
效能(ops/sec)
—
💡 The page may briefly stutter while running. It shows raw elapsed time and ops/s only, with no unified threshold grading; workloads differ, so results are not comparable across workload types.