Test name | Executions per second |
---|---|
Array includes | 16336910.0 Ops/sec |
Set has | 16497643.0 Ops/sec |
Map has | 16057987.0 Ops/sec |
var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var b = new Set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
var c = new Map([[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]);
return a.includes(9);
return b.has(9);
return c.has(9);