Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
slice vs substr vs substring (with no end index)
Compares slice, substr and substring to each other when there is only a start index
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/119.0.6045.169 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 119
Operating system:
iOS 17.1
Device Platform:
Mobile
Date tested:
2 years ago
substring
18.7M/s
slice
18.6M/s
substr
12.2M/s
View exact numbers
Test name
Executions per second
✓
substring
18,652,104 Ops/sec
slice
18,618,698 Ops/sec
substr
12,187,331 Ops/sec
Script Preparation code:
var example = 'there is no spoon'
Tests:
slice
var result = example.slice(10)
substr
var result = example.substr(10)
substring
var result = example.substring(10)