Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
dsadsa
(version: 1)
dsa
Comparing performance of:
Array.find vs Array.indexOf vs Map.has vs Object.hasOwnProperty
Created:
6 months ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = []; var ms = new Map(); var obj = {}; var i = 0; while (i <= 1E5) { arr[i] = i; ms.set(i, i); obj[i] = i; i++; }
Tests:
Array.find
const item = arr.find(item => item == 1E5);
Array.indexOf
const index = arr.indexOf(1E5);
Map.has
ms.has(1E5 - 1);
Object.hasOwnProperty
obj.hasOwnProperty(1E5-1);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Array.find
Array.indexOf
Map.has
Object.hasOwnProperty
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
6 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36
Browser/OS:
Chrome 141 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array.find
2237.8 Ops/sec
Array.indexOf
139589.1 Ops/sec
Map.has
226866512.0 Ops/sec
Object.hasOwnProperty
138108304.0 Ops/sec
Comments
Confirm delete:
Do you really want to delete benchmark?