Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Performance Test: substring vs substr vs slice vs split
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) QwantMobile/6.7.6 Mobile/15E148 Safari/605.1.15
Browser:
Mobile Safari 18
Operating system:
iOS 18.5
Device Platform:
Mobile
Date tested:
one year ago
slice
235.1M/s
substring
228.6M/s
substr
31.2M/s
split
9.5M/s
View exact numbers
Test name
Executions per second
✓
slice
235,120,816 Ops/sec
substring
228,595,856 Ops/sec
substr
31,237,382 Ops/sec
split
9,488,849 Ops/sec
Script Preparation code:
var string = "I am the god of hellfire, and I bring you..."
Tests:
slice
var substring = string.slice(17, 25);
substring
var substring = string.substring(17, 25);
substr
var substring = string.substr(17, 25);
split
var substring = string.split(',')[1];