test and includes

Benchmark created on


Setup

const s = "abcde.ciao#uei";
const loopSize = 10000;

Test runner

Ready to run.

Testing in
TestOps/sec
test
for (let i = 0; i < loopSize; i++)
	for (let j = 0; j < s.length; j++)
		/[#.]/.test(s[j]);
ready
includes
for (let i = 0; i < loopSize; i++)
	for (let j = 0; j < s.length; j++)
		"#.".includes(s[j]);
ready
comparison
for (let i = 0; i < loopSize; i++)
	for (let j = 0; j < s.length; j++)
		s[j] === "#" || s[j] === ".";
ready

Revisions

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