Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
slice VS splice for removing start or end elements
(version: 0)
1M list splice and shift win, they mutate list slice loose, it creates a copy of list 7.5x slower
Comparing performance of:
slice vs splice vs slice end vs splice end
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var list = []; for (var i = 0; i < 1000 * 1000; i++) { list.push(i); }
Tests:
slice
list = list.slice(5);
splice
list = list.splice(5);
slice end
list = list.slice(0, 999995)
splice end
list = list.splice(0, 999995)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
slice
splice
slice end
splice end
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 VS shift: who is the fastest to keep constant size (fork no string push)
slice VS splice VS shift: who is the fastest to keep constant size 100
slice VS splice : who get first 10 items faster
slice VS splice VS shift: smaller list, copy last half of array
slice VS splice VS shift: who is the fastest to keep constant size [VARIANT]
Comments
Confirm delete:
Do you really want to delete benchmark?