RegExp vs Arr

Benchmark created on


Description

Hmm

Setup

let arr = [];
let str = '';
for (let i = 0; i < 10000; i++) {
	let n = Math.floor(Math.random() * 100)
	str += n + '\n';
	arr.push(n);
}

Test runner

Ready to run.

Testing in
TestOps/sec
String match
str.match(/^50$/gm)
ready
Arr includes
arr.includes(50)
ready
Reg Exp test
new RegExp('^50$', 'gm').test(str)
ready

Revisions

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