Regexp performance comparison

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Regexp 1
const r = /^\w(([\w-]*\w)?)$/
const str1 = 'a-b-c-d-e-f-g-h-i-j-k-l-m-n';
str1.match(r);
ready
Regexp 2
const r = /^\w+(-\w+)*$/
const str1 = 'a-b-c-d-e-f-g-h-i-j-k-l-m-n';
str1.match(r);
ready

Revisions

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