Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120
Linux
Desktop
2 years ago
Benchmark.js
string slice
3.5M/s
string substring
1.8M/s
regex replace
1.1M/s
View exact numbers
Test name Executions per second
string slice 3,492,277 Ops/sec
string substring 1,847,922 Ops/sec
regex replace 1,106,691 Ops/sec
Script Preparation code:
Tests: