Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
2d array construction
(version: 1)
Comparing performance of:
1 vs 2 vs 3 vs 4 vs 5 vs 6 vs 7
Created:
one year ago
by:
Registered User
Go to the latest result
Script Preparation code:
rows = 500; cols = 500;
Tests:
1
Array.from({ length: rows }, () => Array().fill(0, 0, cols))
2
Array(rows).fill(null).map(() => Array().fill(0, 0, cols))
3
[...Array(rows)].map(() => Array().fill(0, 0, cols))
4
Array.from(new Array(rows), () => Array().fill(0, 0, cols))
5
Array(rows).fill(0).map(() => Array().fill(0, 0, cols))
6
Array(rows).fill(void 0).map(() => Array().fill(0, 0, cols))
7
Array(rows).fill(undefined).map(() => Array().fill(0, 0, cols))
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (7)
Previous results
Fork
Test case name
Result
1
2
3
4
5
6
7
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser/OS:
Chrome 135 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
2
152K/s
7
151K/s
6
151K/s
5
151K/s
3
150K/s
4
72K/s
1
57K/s
View exact numbers
Test name
Executions per second
✓
2
151,886 Ops/sec
7
151,486 Ops/sec
6
151,393 Ops/sec
5
150,553 Ops/sec
3
149,743 Ops/sec
4
72,440 Ops/sec
1
57,417 Ops/sec
Related benchmarks
fill then map (with null/undefined/""/0) vs for loop vs array.from
Comments
Confirm delete:
Do you really want to delete benchmark?