Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Set<string> vs Array<string> lookup (existing set)
Comparing performance of: Array Lookup vs Set Lookup when the values are string.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36
Browser:
Chrome 151
Operating system:
Windows
Device Platform:
Desktop
Date tested:
15 days ago
Benchmark engine:
Benchmark.js
Set Lookup
923.2M/s
Array Lookup
66.5M/s
View exact numbers
Test name
Executions per second
✓
Set Lookup
923,183,232 Ops/sec
Array Lookup
66,459,252 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const arr = [ 'text', 'search', 'tel', 'url', 'password' ]; const set = new Set(arr);
Tests:
Array Lookup
// exercise all out-of-order using unique string instances (avoid arr[0] ect which would compare by reference) arr.includes('url') arr.includes('text') arr.includes('tel') arr.includes('password') arr.includes('search')
Set Lookup
// exercise all out-of-order using unique string instances (avoid arr[0] ect which would compare by reference) set.has('url') set.has('text') set.has('tel') set.has('password') set.has('search')