Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Chrome 146
Windows
Desktop
4 months ago
for loop
12.9M/s
.split.reduce
9.5M/s
.split.forEach
8.4M/s
String.prototype.reduce
1.7M/s
Array.prototype.forEach
1.7M/s
Array.prototype.reduce.call
1.6M/s
View exact numbers
Test name Executions per second
for loop 12,871,441 Ops/sec
.split.reduce 9,470,044 Ops/sec
.split.forEach 8,388,160 Ops/sec
String.prototype.reduce 1,700,552 Ops/sec
Array.prototype.forEach 1,660,419 Ops/sec
Array.prototype.reduce.call 1,632,480 Ops/sec
Script Preparation code:
Tests: