JavaScript: array VS Set, performance test

This week i was writing some JavaScript easy script for mirroring data. Main job was work wit data in arrays. I was reading data from arrays, make some calculations with data from there and that is it. Easy.

In first implementation i was using array as structure for manipulation with data. And then I was try rewrite manipulation with data to Set.

Tests

Finally i wrote some simple tests for comparing both ways of implementations. I made array and Set of 1.000.000 items and i tried some basic operations on those.

Results

arraySet
creating25.40 ms128.72 ms
iterating through4.24 ms34.72 ms
finding1.01 ms0.01 ms

Source code

array

Set