Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array fill vs map
(version: 1)
People tend to use array fil and then foreach, we know foreach is faster than a for loop, but is it also faster if you use array fill first?
Comparing performance of:
fill vs fill and map
Created:
5 months ago
by:
Guest
Jump to the latest result
Script Preparation code:
var iterations = 10000;
Tests:
fill
new Uint8Array(iterations).fill(0);
fill and map
new Uint8Array(iterations).map((_, i) => 0);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
fill
fill and map
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser/OS:
Firefox 147 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
fill
581684.5 Ops/sec
fill and map
18259.0 Ops/sec
Related benchmarks:
Array fill foreach, vs for i loop
map vs forEach Chris
map vs forEach Chris v2
map vs forEach Chris v2b
Array fill map, vs for i loop
Array fill map, vs while loop
Array fill vs for i loop
Init array with fill map, vs for i loop
Array for vs fill vs map
Comments
Confirm delete:
Do you really want to delete benchmark?