regexp vs indexOf (v77)

Revision 77 of this benchmark created on


Setup

var str = "hello world!";
    var regex = /world/;
    
    var strCamel = "Hello World!";
    var regex_insensitive = /world/i;

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp
str.match(regex);
ready
indexOf
str.indexOf("world");
ready
Regexp insensitive
str.match(regex_insensitive);
ready
indexOf insensitive
str.toLowerCase().indexOf("world");
ready

Revisions

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