regexp vs indexOf case insensitive (v145)

Revision 145 of this benchmark created on


Description

Test which is faster - to lowercase the search string or to use regexp

Preparation HTML

<script>
  var str = "http://a.cubicleoffers.com/script/layer/serve?format=1&img=true&cid=layer_fr&isps=true&cbs=0.4320885317865759&sid=14567725629&terms=kids%20toys%2C%20kids%2C%20toys%2C%20games%2C%20uk&keywords=kids%20toys%2C%20kids%2C%20toys%2C%20games%2C%20uk&dm=very.co.u";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Regexp
str.match(/cubicleoffers/i);
ready
indexOf
str.toLowerCase().indexOf("cubicleoffers");
ready

Revisions

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