Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Chrome 129
Windows
Desktop
one year ago
replace inline regex
3.6M/s
brackets and slice
3.1M/s
substring and substring
3.1M/s
brackets and substring
3.1M/s
substring and slice
3.0M/s
substr and substr (legacy)
3.0M/s
brackets and substr (legacy)
2.9M/s
replace compiled regex var
2.7M/s
View exact numbers
Test name Executions per second
replace inline regex 3,616,665 Ops/sec
brackets and slice 3,111,338 Ops/sec
substring and substring 3,100,164 Ops/sec
brackets and substring 3,099,542 Ops/sec
substring and slice 3,020,669 Ops/sec
substr and substr (legacy) 2,988,775 Ops/sec
brackets and substr (legacy) 2,928,395 Ops/sec
replace compiled regex var 2,690,108 Ops/sec
Script Preparation code:
Tests: