Regex empty vs wilcard

Benchmark created on


Setup

const testData = []
for (let i = 0; i < 100000; i++) {
	testData.push(`TestData-${i}`)
}

Test runner

Ready to run.

Testing in
TestOps/sec
empty
const r = new RegExp()

for (let i = 0; i < testData.length; i++) {
	r.test(testData[i])
}
ready
wildcard
const r = new RegExp("^.*?$")

for (let i = 0; i < testData.length; i++) {
	r.test(testData[i])
}
ready

Revisions

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