Compare searching vs creating a hash set (v2)

Revision 2 of this benchmark created on


Description

Search an array

Setup

var arr = [
'd93bc602-e456-4066-9147-59fa7c1ee124',
'2d1741ad-d1a6-4d59-a5ee-b40482468aa9',
'aa66ee77-a564-4973-b1b4-323ab11f54e1',
'8e351c1c-7d63-475d-bd43-4ebc3d112f91',
'fce53167-a4d8-498c-8eff-3b34c825bb42',
'47408391-fe04-4b3c-8325-112f9c1d8c38',
'32ee37fe-d78c-4aac-935e-f07bf3beaf79',
'024753a8-2014-4fc0-b218-d463c57e07cf',
'8c932c72-f96e-4ec2-b258-bf49378687a7',
'94ef35d0-8885-4b62-9244-163a634a96c2',
'24a23ecb-3561-431e-ac40-ffeefc6811db',
'1b474cc6-819a-424d-a0d3-bbcc7acd8553',
'f22dee4d-6509-41a2-ab28-267c1f273994',
'2f8148f3-3fa4-46a4-83c1-329e5ebe0a78',
'7f6f7e18-4725-49e5-8a7d-3cf9346c245e',
'a21f4af8-6059-4c93-999a-e031571fff63',
'6feb41e5-4b42-48d4-98c8-8d341d06d55b',
'cac143a3-bba4-4e5c-ac40-df364f67d007',
'83f384ba-8717-4af3-8468-7380d4fca32b',
'b1ae29e6-77dd-4ca5-89b1-7c64c09d9b02',
'7819c0fb-1ff6-45b7-b421-ef35d81a41d9',
'be79f4dd-8657-4a79-a265-10ae6cbac592',
'bdc4dd6a-9503-4539-ac53-44c24f7a526b',
'4be31989-f4f4-421e-8523-f3955e8c5fe3',
'dab60345-698e-4f93-a0d6-1fa1e004cc45',
'd5b1d24b-fdab-465d-b17c-3f7d4f8b51c2',
'ad1fd0f4-df93-40b2-bc3e-22b770c6c6ab',
'ec9f3546-3b48-4ce7-a075-94e55d775fce',
'2d5ebb06-0067-41a9-b17d-997e6f839826',
'd5bd8dbf-61fa-4d41-855c-1519ced532b1',
'34ed3c28-59d3-453a-81f5-c7c1668caebc',
'00ebca7e-2a0b-470b-8622-38b509e2a1e4',
'7e8a1dff-a7b3-42f4-8fb2-bf4e3de86f3c',
'856bc3ea-4f3d-4409-936a-2f76d96c3522',
'51ebdc9d-1742-4c6a-9d40-242505d569c0',
'6f420c53-707b-4b27-8caa-e189375f1f72',
'be8a39f4-9630-48ef-be0e-cc0fd4b82bce',
'49dd86ff-17e4-4fad-b379-08951c6835c2',
'ca3e311e-2325-4ef8-9de9-5d8a3f51d079',
'f5d27307-3a13-4e33-b025-1ae930d9af1b'
]

Test runner

Ready to run.

Testing in
TestOps/sec
Search array - twice
var test1 = arr.includes('xxxxxxxx-77dd-4ca5-89b1-7c64c09d9b00')
var test2 = arr.includes('xxxxxxxx-77dd-4ca5-89b1-7c64c09d9b11')
var test3 = arr.includes('xxxxxxxx-77dd-4ca5-89b1-7c64c09d9b22')
var test4 = arr.includes('xxxxxxxx-77dd-4ca5-89b1-7c64c09d9b33')
var test5 = arr.includes('xxxxxxxx-77dd-4ca5-89b1-7c64c09d9b44')

ready
make a hashset - twice
var set = new Set(arr);

var test1 = arr.includes('xxxxxxxx-77dd-4ca5-89b1-7c64c09d9b00')
var test2 = arr.includes('xxxxxxxx-77dd-4ca5-89b1-7c64c09d9b11')
var test3 = arr.includes('xxxxxxxx-77dd-4ca5-89b1-7c64c09d9b22')
var test4 = arr.includes('xxxxxxxx-77dd-4ca5-89b1-7c64c09d9b33')
var test5 = arr.includes('xxxxxxxx-77dd-4ca5-89b1-7c64c09d9b44')

ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.