Compare checking existence in a Set vs an Array.
const size = 10000;
const arr = Array.from({length: size}, (_, i) => i);
const set = new Set(arr);
const target = size / 2;Initializing...
| Test Case | Ops/sec | |
|---|---|---|
| Set.has | | ready |
| Array.includes | | ready |
| Array.indexOf | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.