Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Consider signing in before you create benchmark.322
(version: 0)
Comparing performance of:
1 vs 2
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
var a = [ 5592662, 8882310, 12303546, 3618871, 11053224, 7631988, 11164986, 4879411, 5274935, 5934134, 6000703, 214525, 15527148, 7159078, 7947049, 5719076, 2769693, 10114101, 10705205, 16382457, 5143094, 1579286, 1120523, 6132288, 3560742, 3230754, 9131316, 276686, 5670971, 2566182, 9720627, 4945196, 14869729, 8800557, 3890472, 5585954, 5934654, 279274, 4549679, 406186, 214003, 4417838, 5341240, 2758927, 4022314, 16119542, 11362106, 5538609, 1131946, 6506280, 6579300, 791304, 9146761, 16579836, 16777215, 5868605, 3692839, 1780242, 5604666, 5802556, 4285485, 2439961, 13948116, 403580, 9194800, 8226169, 1318670, 4597272, 10836792, 13487565, 131842, 14672095, 148730, 5934142, 9605778, 5989718, 5868341, 4731677, 5066061, 4473924, 3678741, 2110230, 11230006, 10246454, 10639672, 10266007, 5976863, 15132902, 201014, 607452, 10573108, 10131866, 7237230, 15856114, 5933630, 2897451, 6131767, 5803070, 789514, 82681, 202570, 2827282, 1266650, 82940, 1582352, 14343131, 1320492, 3428900, 2967328, 1978388, 9784627, 5934396, 1576456, 527621, 12962754, 15658990, 1658270, 7042407, 8345907, 12700094, 5385501, 329731, 5802558, 5670715, 14014931, 10902585, 3752755, 10594973, 13291463, 5999926, 9330487, 4871748, 133402, 3691813, 9656374, 5999168, 2307608, 1655159, 6517086, 12239798, 8687486, 2637596, 3357742, 1516049, 664144, 8933681, 11558458, 10246200, 16251381, 3099423, 4681776, 12764098, 4219686, 2308120, 5408057, 214522, 6329913, 3496230, 935619, 138859, 10592417, 6974313, 9410186, 10574904, 5075512, 4483624, 609006, 5868857, 10770233, 3297059, 6065983, 3494179, 872422, 5934653, 15856623, 1922482, 5397325, 9458225, 2039838, 5472825, 5867827, 10965814, 3362852, 8277551, 10377014, 6515551, 5274671, 280316, 5868088, 3560736, 15922418, 529444, 5606972, 3812889, 1661391, 5736764, 2108442, 15987699, 4279100, 5734974, 4803656, 5803838, 3100449, 3167265, 11515820, 3626791, 985093, 1187595, 5076789, 3494687, 66572, 5933375, 5802047, 5736244, 3559719, 4079166, 264202, 16579580, 16645629, 16250871, 16316664, 16711422, 16448507, 9870737, 11579568, 5014326, 6198336, 3092272, 5801276, 1052688, 15462376, 7235952, 9854776, 7294253, 8487041, 460551, 3364132, 16316408, 7699569, 2637591, 6184799, 412154, 6842472, 346101, 16053492, 11163960, 13290441, 14278614, 16579835, 9803157, 10068119, 2315929, 9342606, 5934398, 0, 0 ]; var b = new Map(a.map((value, index) => [value, index]));
Tests:
1
const d = Array.from(b.keys());
2
const c = [...b.keys()];
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
1
2
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser/OS:
Chrome 127 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
2
1.2M/s
1
984K/s
View exact numbers
Test name
Executions per second
✓
2
1,160,068 Ops/sec
1
983,791 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
It looks like we have a long string of data and some benchmarking information. To answer the question, I'll assume you want to know why the two test cases have different execution times: **Test Case 1:** ``` const c = [...b.keys()]; ``` This uses the spread operator (`...`) to create an array from the keys of the `Map` object `b`. The spread operator creates a new array and copies the elements from the original array into it. **Test Case 2:** ``` const d = Array.from(b.keys()); ``` This uses the `Array.from()` method to convert the keys of the `Map` object `b` into an array. This is a more efficient way to create an array, as it avoids the overhead of creating a new array with the spread operator. The reason for the difference in execution times is likely due to the following: * The spread operator creates a new array and copies the elements from the original array into it. This can be slower than using `Array.from()`, which is optimized for creating arrays from iterables. * `Array.from()` uses a more efficient algorithm that avoids the overhead of copying individual elements, making it faster. So, in summary, Test Case 2 is likely to be faster because it uses an optimized method to create an array, while Test Case 1 uses the spread operator which can be slower.
Related benchmarks
uniq vs Set large
Consider signing in before you create benchmark.
Consider signing in before you create benchmark.3
Consider signing in before you create benchmark.3221
Comments
Confirm delete:
Do you really want to delete benchmark?