Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Array initialization: preallocate vs push
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 14; Mobile; rv:122.0) Gecko/122.0 Firefox/122.0
Browser:
Firefox Mobile 122
Operating system:
Android
Device Platform:
Mobile
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
Push
13K/s
Preallocate
12K/s
View exact numbers
Test name
Executions per second
✓
Push
13,033 Ops/sec
Preallocate
11,879 Ops/sec
Tests:
Preallocate
var N = 10000; var result = new Array(N); for (var i = 0; i < N; i++) { result[i] = N; }
Push
var N = 10000; var result = []; for (var i = 0; i < N; i++) { result.push(N); }