Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Array initialization: preallocate vs push (Objects)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:136.0) Gecko/20100101 Firefox/136.0
Browser:
Firefox 136
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
Push
42/s
Preallocate
31/s
View exact numbers
Test name
Executions per second
✓
Push
42 Ops/sec
Preallocate
31 Ops/sec
Tests:
Preallocate
var N = 1000000; var result = new Array(N); for (var i = 0; i < N; i++) { result[i] = { value: N }; }
Push
var N = 1000000; var result = []; for (var i = 0; i < N; i++) { result.push({ value: N }); }