Created
January 21, 2016 10:35
Revisions
-
AdriVanHoudt created this gist
Jan 21, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ const Hoek = require('hoek'); const array = []; for (let i = 0; i < 5000000; ++i) { array.push(i * Math.floor(Math.random() * (10 - 1 + 1)) + 1); } console.time('hoek'); const result = []; for (let i = 0; i < array.length; ++i) { result.push(array[i]); } const resultHoek = Hoek.unique(result); console.timeEnd('hoek') console.time('set'); const result2 = new Set(); for (let i = 0; i < array.length; ++i) { result2.add(array[i]); } const result2Set = Array.from(result2); console.timeEnd('set')