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
6.5M/s
substring and substring
6.3M/s
substr and substr (legacy)
6.2M/s
brackets and slice
6.2M/s
substring and slice
6.2M/s
brackets and substring
6.1M/s
brackets and substr (legacy)
6.0M/s
replace compiled regex var
5.0M/s
View exact numbers
Test name Executions per second
replace inline regex 6,463,876 Ops/sec
substring and substring 6,254,426 Ops/sec
substr and substr (legacy) 6,222,428 Ops/sec
brackets and slice 6,160,420 Ops/sec
substring and slice 6,151,848 Ops/sec
brackets and substring 6,107,670 Ops/sec
brackets and substr (legacy) 5,956,191 Ops/sec
replace compiled regex var 5,021,618 Ops/sec
Script Preparation code:
Tests: