Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:138.0) Gecko/20100101 Firefox/138.0
Firefox 138
Mac OS X 10.15
Desktop
one year ago
Benchmark.js
Helper function for each className
1.4M/s
Reduce but with optimized parameters
311K/s
Reduce
219K/s
Join only valid strings
163K/s
Reduce but no template string
151K/s
Push valid to array and join
135K/s
Filter and join
89K/s
Join and replace false
88K/s
View exact numbers
Test name Executions per second
Helper function for each className 1,407,652 Ops/sec
Reduce but with optimized parameters 311,479 Ops/sec
Reduce 219,412 Ops/sec
Join only valid strings 163,035 Ops/sec
Reduce but no template string 151,242 Ops/sec
Push valid to array and join 134,743 Ops/sec
Filter and join 88,806 Ops/sec
Join and replace false 88,107 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: