Test name | Executions per second |
---|---|
Sets | 344491.9 Ops/sec |
Arrays | 697001.1 Ops/sec |
const array1 = Array.from({length: 100}, () => Math.floor(Math.random() * 140));
const array2 = Array.from({length: 100}, () => Math.floor(Math.random() * 140));
const set1 = new Set(array1);
const set2 = new Set(array2);
set1.difference(set2);
array1.filter((id) => !array2.includes(id));