Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134
Linux
Desktop
one year ago
for loop pre-allocate cached length
247K/s
for loop pre-allocate
201K/s
for loop push
172K/s
Array.from with map
81K/s
Spread with map
78K/s
Array.from with second parameter
73K/s
View exact numbers
Test name Executions per second
for loop pre-allocate cached length 247,395 Ops/sec
for loop pre-allocate 200,795 Ops/sec
for loop push 172,333 Ops/sec
Array.from with map 81,004 Ops/sec
Spread with map 78,353 Ops/sec
Array.from with second parameter 73,383 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: