Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Set.has VS Array.some
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0
Browser:
Firefox 140
Operating system:
Windows
Device Platform:
Desktop
Date tested:
10 months ago
Test name
Executions per second
Set.has multiple
51354.1 Ops/sec
Array.some multiple
17197.1 Ops/sec
Set.has single
56541.8 Ops/sec
Array.some single
93623.2 Ops/sec
Tests:
Set.has multiple
const oldData = Array.from({ length: 500 }, (x, i) => ({ id: String(i), x: 0, y: 0 })); const newData = Array.from({ length: 50 }, (x, i) => ({ id: String(i * 10), x: 1, y: 1 })); const oldDataSet = new Set(oldData.map((od) => od.id)); for (const nd of newData) { const has = oldDataSet.has(nd.id); }
Array.some multiple
const oldData = Array.from({ length: 500 }, (x, i) => ({ id: String(i), x: 0, y: 0 })); const newData = Array.from({ length: 50 }, (x, i) => ({ id: String(i * 10), x: 1, y: 1 })); for (const nd of newData) { const has = oldData.some((od) => od.id === nd.id); }
Set.has single
const oldData = Array.from({ length: 500 }, (x, i) => ({ id: String(i), x: 0, y: 0 })); const findId = "450"; const oldDataSet = new Set(oldData.map((od) => od.id)); const has = oldDataSet.has(findId);
Array.some single
const oldData = Array.from({ length: 500 }, (x, i) => ({ id: String(i), x: 0, y: 0 })); const findId = "450"; const has = oldData.some((od) => od.id === findId);