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
Reduce but with optimized parameters
287K/s
Reduce
189K/s
Join only valid strings
150K/s
Reduce but no leading space
149K/s
Reduce but no template string
146K/s
Push valid to array and join
92K/s
Filter and reduce
90K/s
Filter and join
86K/s
Join and replace false
83K/s
View exact numbers
Test name Executions per second
Reduce but with optimized parameters 287,495 Ops/sec
Reduce 188,979 Ops/sec
Join only valid strings 150,248 Ops/sec
Reduce but no leading space 148,840 Ops/sec
Reduce but no template string 145,581 Ops/sec
Push valid to array and join 92,244 Ops/sec
Filter and reduce 90,225 Ops/sec
Filter and join 85,604 Ops/sec
Join and replace false 83,027 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: