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
Jump 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
Test name
Executions per second
slice
3609126.2 Ops/sec
split
4196905.0 Ops/sec
Related benchmarks:
split vs substring
Slice vs substr
slice vs substring
Slice with/without end index
slice substring
String.split vs String.substring
slice vs substring (with end index)
JS: split vs slice
slice vs substring with specified start and end
Slice vs Split time benchmark
Comments
Confirm delete:
Do you really want to delete benchmark?