Unique (v2)

Revision 2 of this benchmark created on


Setup

const items = [...Array(100)].map((_, i) => ({ type: i % 10 }));

Test runner

Ready to run.

Testing in
TestOps/sec
Map/Filter
const allTypes = items.map((device) => device.type).filter((type, index, self) => self.indexOf(type) === index);
ready
Set
const allTypes = Array.from(new Set(items.map(({ type }) => type)))
ready

Revisions

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