Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array and direct object access
(version: 1)
Comparing performance of:
100 find vs 1000 find vs 10000 find vs 100000 find vs 10000 obj
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const createTestData = (size) => { const arr = []; const obj = {}; for (let i = 0; i < size; i++) { const id = `type:${i}`; const element = { id, value: Math.random() }; arr.push(element); obj[id] = element; } return { arr, obj }; } const data = createTestData(100000);
Tests:
100 find
const length = 100 data.arr.slice(0, length).find(item => item.id === `type:${length}`);
1000 find
const length = 1000 data.arr.slice(0, length).find(item => item.id === `type:${length}`);
10000 find
const length = 10000 data.arr.slice(0, length).find(item => item.id === `type:${length}`);
100000 find
const length = 10000 data.obj[`type:${length}`]
10000 obj
const length = 10000 data.obj[`type:${length}`]
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
100 find
1000 find
10000 find
100000 find
10000 obj
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?