Array Dedupe: Array.from, Array.filter, or set spread? (v2)

Revision 2 of this benchmark created on


Setup

let cart = [1,1,2,3,4,5,2,3,5,3,2,4,7,8,4,2,1,12,3,4,4,5,2,3,5,67,1,2,3,4,5,6,4,2,1,2,4,6,75,4,2,234,5,6,3,23,4,6,7,2,2,2,2,2,2,2,4,4]		

Test runner

Ready to run.

Testing in
TestOps/sec
Array.from
cart = Array.from(new Set(cart))
ready
spread operator
cart = [...new Set(cart)]
ready
filter
cart = cart.filter(function(item, pos) {
    return cart.indexOf(item) == pos;
})
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.