Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array#includes() vs. Set#has() vs. Object.hasOwn()
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Array#includes()
86357992.0 Ops/sec
Set#has()
219870448.0 Ops/sec
Object.hasOwn()
116058432.0 Ops/sec
Script Preparation code:
var arr = Array.from({ length: 10 }, (_, i) => i + 1); var a = [...arr]; var b = new Set(arr); var c = Object.fromEntries(arr.map((v) => [v, true]));
Tests:
Array#includes()
return a.includes(9)
Set#has()
return b.has(9)
Object.hasOwn()
return Object.hasOwn(c, '9')