Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Set.has vs Array.includes for small number of items Bv1
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
array_1
109126928.0 Ops/sec
set_1
130552416.0 Ops/sec
array_8
93259328.0 Ops/sec
set_8
122813024.0 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const item_1 = Math.floor(Math.random() * 1); const array_1 = new Array(1).map((_, i) => i); const set_1 = new Set(array_1); const item_2 = Math.floor(Math.random() * 2); const array_2 = new Array(1, 2).map((_, i) => i); const set_2 = new Set(array_2); const item_4 = Math.floor(Math.random() * 4); const array_4 = new Array(1, 2, 3, 4).map((_, i) => i); const set_4 = new Set(array_4); const item_8 = Math.floor(Math.random() * 8); const array_8 = new Array(1, 2, 3, 4, 5, 6, 7, 8).map((_, i) => i); const set_8 = new Set(array_8);
Tests:
array_1
array_1.includes(item_1)
set_1
set_1.has(item_1)
array_8
array_8.includes(item_8)
set_8
set_8.has(item_8)