dispatch status test (v2)

Revision 2 of this benchmark created on


Setup

const size = 10000;
const data = Array.from({ length: size }, (_, i) => ({
  customer: { id: `id${i}` },
  dispatchStatus: 'pending'
}));

Test runner

Ready to run.

Testing in WebKit 537.36 / undefined
TestOps/sec
Lookup in Loop using Map
const map = new Map(data.map(d => [d.customer.id, d]));

for (const entry of data) {
	map.get(entry.customer.id)
}
ready
Lookup in Loop using Array.find()
for (const entry of data) {
	data.find(({customer}) => customer.id === entry.customer.id)
}
ready

Revisions

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