Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Array initialization: preallocate vs push with objects
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0
Browser:
Chrome 144
Operating system:
Linux
Device Platform:
Desktop
Date tested:
6 months ago
Benchmark engine:
Benchmark.js
Preallocate
42K/s
Push
21K/s
View exact numbers
Test name
Executions per second
✓
Preallocate
42,377 Ops/sec
Push
21,410 Ops/sec
Tests:
Preallocate
var N = 10000; var result = new Array(N); for (var i = 0; i < N; i++) { result[i] = {n: N}; }
Push
var N = 10000; var result = []; for (var i = 0; i < N; i++) { result.push({n: N}); }