Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Chrome 121
Windows
Desktop
2 years ago
replace inline regex
10.6M/s
brackets and substr (legacy)
9.4M/s
substring and substring
9.4M/s
brackets and slice
9.4M/s
brackets and substring
9.4M/s
substring and slice
9.4M/s
substr and substr (legacy)
9.3M/s
replace compiled regex var
8.1M/s
View exact numbers
Test name Executions per second
replace inline regex 10,571,438 Ops/sec
brackets and substr (legacy) 9,431,033 Ops/sec
substring and substring 9,427,686 Ops/sec
brackets and slice 9,372,589 Ops/sec
brackets and substring 9,363,469 Ops/sec
substring and slice 9,352,053 Ops/sec
substr and substr (legacy) 9,343,233 Ops/sec
replace compiled regex var 8,088,792 Ops/sec
Script Preparation code:
Tests: