Testing large amount of numbers (v3)

Revision 3 of this benchmark created on


Setup

const numbersArray = [...Array(1000).keys()];
const TARGET = 348;
const premadeSet = new Set(numbersArray);

Test runner

Ready to run.

Testing in
TestOps/sec
Using Some
numbersArray.some((number) => number === TARGET);
ready
Using Includes
numbersArray.includes(TARGET);
ready
Using has with premade Set
premadeSet.has(TARGET);
ready
Using has with Set made on the fly
const onFlySet = new Set(numbersArray);

onFlySet.has(TARGET);
ready

Revisions

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