set vs array (small data)

Benchmark created on


Setup

const set = new Set([ "draft", "reviewed", "approved" ]);

const array = [ "draft", "reviewed", "approved" ];

Test runner

Ready to run.

Testing in
TestOps/sec
Set#has
set.has("approved")
ready
Array#includes (third item)
array.includes("approved")
ready
Array#includes (2nd item)
array.includes("reviewed")
ready
Array#includes (first item)
array.includes("draft")
ready

Revisions

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