Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
splice vs slice
(version: 1)
Comparing performance of:
slice and slice vs slice and splice vs only slice vs only splice
Created:
5 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
var a = [] for (var i = 0; i < 1000 * 1000; i++) { a.push(i); }
Tests:
slice and slice
var i = a.slice().reverse().findIndex(x => x !== '') a = a.slice(0, a.length - i)
slice and splice
var i = a.slice().reverse().findIndex(x => x !== '') a.splice(a.length - i)
only slice
var i = a.reverse().findIndex(x => x !== '') a = a.slice(i).reverse()
only splice
var i = a.reverse().findIndex(x => x !== '') a.splice(0, i) a.reverse()
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
slice and slice
slice and splice
only slice
only splice
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Slice vs splice
Slice vs Splice delete 1000
Subarray - Splice vs Slice
Slice vs splice forked
delete a element and return new array with slice vs splice
Comments
Confirm delete:
Do you really want to delete benchmark?