Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Iterator to Array Benchmark 2
(version: 0)
Comparing performance of:
Array.from vs spread vs push
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
let map = new Map(Array.from({ length: 5000 }, (_, i) => [String(i + 1), { id: 'a'.repeat(2048) }]));
Tests:
Array.from
const result = Array.from(map.values()); console.log(result);
spread
const result = [...map.values()]; console.log(result);
push
const result = []; for (const v of map.values()) { result.push(v); } console.log(result);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Array.from
spread
push
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?