Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
slice vs split vs substring (with start and end)
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Browser:
Chrome 125
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
slice
8028710.0 Ops/sec
split
8486549.0 Ops/sec
substring
6998007.0 Ops/sec
Script Preparation code:
var str = "https://line.me/R/app/234?argument=AAAAA160&liff_id=234&client_id=def&basic_id=uvw";
Tests:
slice
var result = str.slice(0, str.indexOf('?'));
split
var result = str.split('?')[0];
substring
var result = str.substring(0, str.indexOf('?'));