Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
unshift() vs push() vs allocate-fill()
(version: 1)
Comparing performance of:
unshift vs push vs allocate-fill
Created:
one year ago
by:
Registered User
Jump to the latest result
Tests:
unshift
let a = []; for(var i = 0; i < 100000; ++i) { a.unshift(i); }
push
let a = []; for(var i = 0; i < 100000; ++i) { a.push(i); }
allocate-fill
var array = Array(100000); for(var i = 0; i < array.length; ++i) { array[i] = i; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
unshift
push
allocate-fill
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
8 months ago
)
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_6_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Mobile/15E148 Safari/604.1
Browser/OS:
Mobile Safari 18 on iOS 18.6.2
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
unshift
1.0 Ops/sec
push
3879.4 Ops/sec
allocate-fill
18242.3 Ops/sec
Related benchmarks:
Array initialization: preallocate vs push
pop() vs shift() vs unshift vs pop
unshift vs push
pop() vs shift() vs unshift vs pop #2
slice vs new allocation
Array initialization: preallocate vs push vs preallocate & fill
Array initialization: preallocate_add_end vs push
Array initialization: preallocate vs push (Objects)
unshift() vs push() vs fill()
Comments
Confirm delete:
Do you really want to delete benchmark?