Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array.from() vs new Array() without callback
(version: 3)
Comparing performance of:
new Array() vs Array.from()
Created:
one year ago
by:
Registered User
Jump to the latest result
Tests:
new Array()
const renderEmptyPricingTableColumns = ({ length }) => { const emptyPeriodArray = new Array(length).fill(null); return emptyPeriodArray.map((_, idx) => ( "empty-period-"+idx ?? 0 )); }; renderEmptyPricingTableColumns({length : 500})
Array.from()
const renderEmptyPricingTableColumns = ({ length }) => { const emptyPeriodArray = Array.from({length}); return emptyPeriodArray.map((_, idx) => ( "empty-period-"+idx ?? 0 )); } renderEmptyPricingTableColumns({length : 500})
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
new Array()
Array.from()
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/131.0.0.0 Safari/537.36
Browser/OS:
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
new Array()
332791.5 Ops/sec
Array.from()
70605.1 Ops/sec
Related benchmarks:
Array creation
for vs map to fill array
map vs for vs for (init array)
TestArrayAllocationsAndFilling
TestArrayAllocationv2
dfgdfuytuty
Performance of JavaScript .forEach, .map and .reduce vs for and for..ofdasdadadasd ca2qdd
for-of-foreach
array.length === 0 vs !array.length
Comments
Confirm delete:
Do you really want to delete benchmark?