Script Preparation code:
AخA
 
var string = "0123456789";
var regex = /^\d+$/;
Tests:
  • RegEx.test

     
    regex.test(string);
  • String.includes

     
    "0123456789".includes(string);
  • for

     
    for (let i = 0; i < string.length; i++) {
        const char = +string.charAt(i);
        if (
            char === 0 ||
            char === 1 ||
            char === 3 ||
            char === 4 ||
            char === 5 ||
            char === 6 ||
            char === 7 ||
            char === 8 ||
            char === 9
        ) {}
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    RegEx.test
    String.includes
    for

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Chrome 115 on Windows
View result in a separate tab
Test name Executions per second
RegEx.test 7623568.5 Ops/sec
String.includes 18352424.0 Ops/sec
for 835155.1 Ops/sec