Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JS Object Creation vs Pooling
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/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Dynamic Creation
6140.5 Ops/sec
Pooling
11826.9 Ops/sec
Script Preparation code:
const n = 10000 var arr = new Array(n).fill(0); for (let i = 0; i < n; i++) { arr[i] = i; }
Tests:
Dynamic Creation
const result = []; for (let i = 0; i < arr.length; i++) { result.push({ x: arr[i], y: arr[i] + 1 }); }
Pooling
const result = []; const obj = { x: 0, y: 0 }; for (let i = 0; i < arr.length; i++) { obj.x = arr[i]; obj.y = arr[i] + 1; result.push(obj); }