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
Jump 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
Test name
Executions per second
1
57417.0 Ops/sec
2
151886.1 Ops/sec
3
149743.1 Ops/sec
4
72439.6 Ops/sec
5
150552.7 Ops/sec
6
151392.6 Ops/sec
7
151486.1 Ops/sec
Related benchmarks:
My Bench
Creating array.....
Create New Array & Fill it
11qwqw
Create Array of length 10, where each element is an empty array
Add 10 elements to an Array where each element includes an empty array
TestArrayAllocation
TestArrayAllocationv2
fill then map (with null/undefined/""/0) vs for loop vs array.from
Comments
Confirm delete:
Do you really want to delete benchmark?