Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Set.difference vs Filter + includes
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Sets
344491.9 Ops/sec
Arrays
697001.1 Ops/sec
Script Preparation code:
const array1 = Array.from({length: 100}, () => Math.floor(Math.random() * 140)); const array2 = Array.from({length: 100}, () => Math.floor(Math.random() * 140));
Tests:
Sets
const set1 = new Set(array1); const set2 = new Set(array2); set1.difference(set2);
Arrays
array1.filter((id) => !array2.includes(id));