Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Array.from({ length }) vs new Array()
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36 OPR/136.0.0.0 (Edition developer)
Browser:
Opera 136
Operating system:
Windows
Device Platform:
Desktop
Date tested:
29 days ago
Benchmark engine:
Benchmark.js
new Array(length)
40/s
new Array(length) (index fill)
11/s
Array.from({ length }) (index fill)
2/s
Array.from({ length })
2/s
View exact numbers
Test name
Executions per second
✓
new Array(length)
40 Ops/sec
new Array(length) (index fill)
11 Ops/sec
Array.from({ length }) (index fill)
2 Ops/sec
Array.from({ length })
2 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
Array.from({ length })
Array.from({ length: 10000000 })
new Array(length)
new Array(10000000)
Array.from({ length }) (index fill)
Array.from({ length: 10000000 }, (_, idx) => idx);
new Array(length) (index fill)
new Array(10000000).map((_, idx) => idx)