Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Test push spread map
(version: 0)
Comparing performance of:
spread vs push
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
const map1 = new Map([ ['key1', 'value1'], ['key2', 'value2'], ['key3', 'value3'] ]); const map2 = new Map([ ['key4', 'value4'], ['key5', 'value5'], ['key6', 'value6'] ]);
Tests:
spread
const keysFromMap1 = Array.from(map1.keys()); const keysFromMap2 = Array.from(map2.keys()); // Concatenate keys from both maps const allKeys = [...keysFromMap1, ...keysFromMap2]; console.log(allKeys);
push
const allKeys = []; // Add keys from map1 to allKeys for (const key of map1.keys()) { allKeys.push(key); } // Add keys from map2 to allKeys for (const key of map2.keys()) { allKeys.push(key); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
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?