Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
get first string segment: split vs slice
(version: 1)
Javascript split vs slice performance
Comparing performance of:
slice vs split
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
var name = 'foo:bar'
Tests:
slice
name.split(0, name.indexOf(':'))
split
name.split(':')[0]
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
slice
split
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0
Browser/OS:
Chrome 131 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
split
4.2M/s
slice
3.6M/s
View exact numbers
Test name
Executions per second
✓
split
4,196,905 Ops/sec
slice
3,609,126 Ops/sec
Related benchmarks
split vs substring
slice substring
slice vs substring (with end index)
Comments
Confirm delete:
Do you really want to delete benchmark?