regexp test vs indexOf (v97)

Revision 97 of this benchmark created by Fergal on


Preparation HTML

<script>

var needle = "bar",
    stack = "foo bar joe doe"



</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp test
var regexp = new RegExp(needle, "i");
regexp.test(stack);
ready
indexOf toLowerCase
stack.toLowerCase().indexOf(needle.toLowerCase());
ready
Regexp search
var regexp = new RegExp(needle, "i");
stack.search(regexp);
ready
Regexp exec
var regexp = new RegExp(needle, "i");
regexp.exec(stack);
ready

Revisions

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