Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.apply vs .from vs map vs loop
Compare the performance of various array creation methods.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Browser:
Chrome 145
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one month ago
Test name
Executions per second
Array.apply
15546792.0 Ops/sec
Array.from
3618127.2 Ops/sec
map
56058112.0 Ops/sec
Loop and assign
69931736.0 Ops/sec
Loop and push
59968476.0 Ops/sec
Tests:
Array.apply
Array.apply(null, new Array(10)).map(() => false);
Array.from
Array.from({ length: 10}, () => false);
map
new Array(10).map(() => false);
Loop and assign
const r = []; for (let i = 0; i < 10; i++) r[i] = false;
Loop and push
const r = []; for (let i = 0; i < 10; i++) r.push(false);