=== vs test vs match (v4)

Revision 4 of this benchmark created on


Setup

var numbersRegex = /^\d+$/
    var noWhiteSpaceRegex = /^\S*$/
    var positveIntegerRegex = /^[0-9]\d*$/
    
    var number = "234524543";
    var white = "545mmckdddjl..21][a/z''";
    var positiveInteger = "-423.123";
    var x = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
test
if (numbersRegex.test(number)) x++;

if (noWhiteSpaceRegex.test(white)) x++;

if (positveIntegerRegex.test(positiveInteger)) x++;
ready
match
if (number.match(numbersRegex)) x++;

if (white.match(noWhiteSpaceRegex)) x++;

if (positiveInteger.match(positveIntegerRegex)) x++;
ready
===
if (number === "234524543") x++;

if (white === "545mmckdddjl..21][a/z''") x++;

if (positiveInteger === "-423.123") x++;
ready

Revisions

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