regexp .exec vs .match

JavaScript performance comparison

Revision 3 of this test case created

Info

comparing the performance of the RexExp object's exec() method vs. the String object's match() method for regular expression matching

Preparation code

<script>
  var url = "http://www.google.com/some/long/thing?foo=bar"
  var re = /https?:\/\/([^\/]+)/i;
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
.exec()
re.test(url)
pending…
.match()
url.match(re)
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment