Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Set.has vs Array.includes for small number of items Bv2
(version: 1)
Comparing performance of:
array_1 vs set_1 vs array_8 vs set_8
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const array_1 = new Array(1).map((_, i) => self.crypto.randomUUID() ); const set_1 = new Set(array_1); const item_1 = array_1[0]; const array_2 = new Array(1, 2).map((_, i) => self.crypto.randomUUID() ); const set_2 = new Set(array_2); const item_2 = array_2[1]; const array_4 = new Array(1, 2, 3, 4).map((_, i) => self.crypto.randomUUID() ); const set_4 = new Set(array_4); const item_4 = array_2[3]; const array_8 = new Array(1, 2, 3, 4, 5, 6, 7, 8).map((_, i) => self.crypto.randomUUID() ); const set_8 = new Set(array_8); const item_8 = array_2[7];
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)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
array_1
set_1
array_8
set_8
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
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/OS:
Chrome 132 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
array_1
111677096.0 Ops/sec
set_1
103426296.0 Ops/sec
array_8
94897240.0 Ops/sec
set_8
90601432.0 Ops/sec
Related benchmarks:
.find() vs direct access in object by id
Map vs Object UUID Key/Value
Array.find vs. Map.get (small scale)
Set string vs number
Set string vs number #1
structuredClone vs Immer
my testtestets
Set.has vs Array.includes for small number of items
Set.has vs Array.includes for small number of items Bv1
Comments
Confirm delete:
Do you really want to delete benchmark?