Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
substring vs slice on string
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36
Browser:
Chrome 149
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one month ago
slice
232.4M/s
substring
231.6M/s
View exact numbers
Test name
Executions per second
✓
slice
232,395,440 Ops/sec
substring
231,623,120 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const id = '123818727033' const id_with = '123818727033_2'
Tests:
substring
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/ const base1 = id.substring(0,12) const base2 = id_with.substring(0,12)
slice
const base1 = id.slice(0,12) const base2 = id_with.slice(0,12)