array-unique icon indicating copy to clipboard operation
array-unique copied to clipboard

Create for.js

Open vlazar opened this issue 10 years ago • 3 comments
trafficstars

Same as https://github.com/jonschlinkert/array-unique/blob/master/benchmark/code/while.js, but preserves the order of elements in result array, which is nice to have.

Performance is almost as good as while.js

BTW, is there any reason the implementation in https://github.com/jonschlinkert/array-unique/blob/master/index.js is not from https://github.com/jonschlinkert/array-unique/blob/master/benchmark/code/while.js ?

For me on node 0.12.0 array-uniq with Set is the fastest on arrays bigger than 1000 elements. In all other cases https://github.com/jonschlinkert/array-unique/blob/master/benchmark/code/while.js is the fastest.

vlazar avatar Jun 21 '15 14:06 vlazar

Ah, and the description for https://www.npmjs.com/package/array-unique currently says

Return an array free of duplicate values.

which is confusing, as current implementation from https://github.com/jonschlinkert/array-unique/blob/master/index.js removes elements from the original array.

vlazar avatar Jun 21 '15 14:06 vlazar

this is great! thanks for all the hard work and making this lib better! I have some father's day stuff going on today, but I'll review and merge in your pr as soon as I have a chance

jonschlinkert avatar Jun 21 '15 15:06 jonschlinkert

Sure, important stuff first. Thanks for super quick reply, really appreciate.

vlazar avatar Jun 21 '15 15:06 vlazar