regexp vs toLowerCase and indexOf (v138)

Revision 138 of this benchmark created on


Setup

var str = "hello World!";
    var filterS = "worl";
    var regexpS = new RegExp(filterS, 'i');
    var matchFound = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp
if (regexpS.test(str)) {
   matchFound += 1;
}
ready
indexOf
if (str.toLowerCase().indexOf(filterS) >= 0) {
   matchFound += 1;
}
ready

Revisions

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