Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Multiple shift versus Index
(version: 2)
Comparing performance of:
Move Indexes vs Shift vs Splice vs Slice
Created:
one year ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const list = new Array(1000).fill("value"); const list2 = new Array(1000).fill("value"); const list3 = new Array(1000).fill("value"); const list4 = new Array(1000).fill("value");
Tests:
Move Indexes
let i = 100; while (i < 1000) { list[i - 100] = list[i]; i++; } list.length = 900;
Shift
let i = 0; while (i < 100) { list2.shift(); i++; }
Splice
list3.splice(0, 100);
Slice
list4.slice(100);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Move Indexes
Shift
Splice
Slice
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser/OS:
Chrome 134 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Move Indexes
189735.0 Ops/sec
Shift
1124463.4 Ops/sec
Splice
25837784.0 Ops/sec
Slice
3386710.2 Ops/sec
Related benchmarks:
Shift loop vs unrolled
Shift loop vs unrolled
Shift loop vs unrolled
arrayloops
pop() vs shift() vs unshift vs pop
pop() vs shift() vs unshift vs pop vs index
shift vs index
JS Array Mutation Test
test shift
Comments
Confirm delete:
Do you really want to delete benchmark?