Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Set.difference vs Filter + includes
(version: 1)
Comparing performance of:
Sets vs Arrays
Created:
one year ago
by:
Guest
Go to the latest result
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));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Sets
Arrays
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
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/OS:
Chrome 132 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Arrays
697K/s
Sets
344K/s
View exact numbers
Test name
Executions per second
✓
Arrays
697,001 Ops/sec
Sets
344,492 Ops/sec
Related benchmarks
Set vs Filter for unique
Set vs Filter vs forEach for unique
Set vs Filter vs forEach vs forLoop for unique
Array Diffs
Comments
Confirm delete:
Do you really want to delete benchmark?