Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0
Chrome 142
Windows
Desktop
8 months ago
Using String.slice() without a pre-calculated suffix length
669/s
Using String.slice()
667/s
Using String.substring() with a magic number
627/s
Using String.substring() with a lastIndexOf() search
340/s
Using String.replace()
273/s
View exact numbers
Test name Executions per second
Using String.slice() without a pre-calculated suffix length 669 Ops/sec
Using String.slice() 667 Ops/sec
Using String.substring() with a magic number 627 Ops/sec
Using String.substring() with a lastIndexOf() search 340 Ops/sec
Using String.replace() 273 Ops/sec
Script Preparation code:
Tests: