Items in regex group perf

JavaScript performance comparison

Test case created by David Murdoch

Preparation code

<script>
  var reg1 = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i;
  var reg2 = /^(?:week|color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url)$/i;
  var i1 = 0;
  var i2 = 0;
</script>
    

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Match Last Item
if (reg1.test("week")) {
 i1++; // a side effect to avoid browser optimization
}
pending…
Match First Item
if (reg2.test("week")) {
 i2++; // a side effect to avoid browser optimization
}
pending…

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

Compare results of other browsers

0 Comments