regexp .exec vs .match
JavaScript performance comparison
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.
| Test | Ops/sec | |
|---|---|---|
.exec() |
|
pending… |
.match() |
|
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:
- Revision 2: published by Norm Yee
- Revision 3: published
- Revision 4: published by ben
0 comments