RegExp test vs. Match
JavaScript performance comparison
Info
Check performance of simple regex use case of seeing whether a candidate string matches a regex.
Preparation code
<script>
var strings = [];
for (var i = 0; i < 500; ++i) {
strings[i] = "The end of the beginning? Or the beginning of the end?";
}
var regex1 = /beginning/,
regex2 = /(end of).*(end)/,
regex3 = /beginnizg/;
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Match |
|
pending… |
Test |
|
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 1: published by Pointy
0 comments