Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Initializing array with map function
worth to note that the maximum callstack size is exceeded for the first test case (spread operator) with n = 1 million
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; Quest 3) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/36.0.0.63.54.660846222 Chrome/130.0.6723.86 VR Safari/537.36
Browser:
Chrome 130
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
[...Array(n).keys()].map(filler)
57.4 Ops/sec
Array.apply(null, { length: 4 }).map(filler)
62.8 Ops/sec
Array.from
49.7 Ops/sec
Array(n).fill(undefined).map(filler)
106.7 Ops/sec
for loop push
101.0 Ops/sec
Script Preparation code:
var n = 100000; // 100k function filler(v, i) { return i ** 2; }
Tests:
[...Array(n).keys()].map(filler)
[...Array(n).keys()].map(filler);
Array.apply(null, { length: 4 }).map(filler)
Array.apply(null, { length: n }).map(filler);
Array.from
Array.from({ length: n }, filler);
Array(n).fill(undefined).map(filler)
Array(n).fill(undefined).map(filler)
for loop push
const arr = []; for (let i = 0; i < n; i++) { arr.push(filler(null, i)); }