http://codereview.chromium.org/2645002/diff/2001/3001 File src/regexp.js (right):
http://codereview.chromium.org/2645002/diff/2001/3001#newcode262 src/regexp.js:262: var regexp_val; On 2010/06/04 11:30:33, Lasse Reichstein wrote:
How often do you hit this? (And how often will you hit it if you cache
negative
results in the global regexp cache)?
Caching negative results in the global regexp cache won't change the hit rate for this cache as test is often called with a new string. http://codereview.chromium.org/2645002/diff/2001/3001#newcode299 src/regexp.js:299: if (%_StringCharCodeAt(this.source,0) == 46 && // '.' On 2010/06/04 11:30:33, Lasse Reichstein wrote:
You may want to try moving this.source to a local variable. It is used
a lot.
Ditto for this.source.length.
Tried this. Causes regressions on some benchmarks http://codereview.chromium.org/2645002/diff/2001/3001#newcode313 src/regexp.js:313: if (!regexp_val.test(s)) return false; On 2010/06/04 11:30:33, Lasse Reichstein wrote:
You can cache the negative result in the regexp cache here (using the
original
regexp as key). That means that next time you call test, the global
regexp cache
will match and you don't even get here.
Often test is called with a new string so that won't really pay off in the end. http://codereview.chromium.org/2645002/show -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
