Check Set

Benchmark created on


Setup

const values = [];

for (let i = 0; i < 10_000; i++) {
	values.push(Math.random())
}

const set = new Set();

Test runner

Ready to run.

Testing in
TestOps/sec
Has Check
for (const value of values) {
	if (!set.has(value)) {
		set.add(value);
	}
}
ready
No Has Check
for (const value of values) {
	set.add(value);
}
ready

Revisions

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