Caching vs RegExp Literal
JavaScript performance comparison
Info
Does storing regular expressions in a variable help?
Preparation code
<script>var expression = /World/;</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
RegExp |
|
pending… |
Cached RegExp |
|
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 Aadit M Shah
- Revision 2: published and last updated
- Revision 9: published by Ian Nartowicz
0 comments