WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
22303
Optimize /^x/ regexps to fail fast
https://bugs.webkit.org/show_bug.cgi?id=22303
Summary
Optimize /^x/ regexps to fail fast
Geoffrey Garen
Reported
2008-11-16 21:27:37 PST
See
bug 18086
-- let's do that optimization in WREC. Here's what I think can be a layout test: // Check that an initial ^ will result in a faster match fail. var s = "a"; var i; for (i = 0; i < 20; i++) s = s + s; function test(string, regexp) { var start = new Date; for (i = 0; i < 100; i++) regexp.test(s); return new Date - start; } var result1 = test(s, /b/); var result2 = test(s, /^b/); alert(result1); alert(result2); if ((result1 - result2) / result1 > .75) testPassed("Congrats, your browser didn't hang!"); testFailed("/^b/ did not discover a match failure faster than /b/"); var successfullyParsed = true;
Attachments
Add attachment
proposed patch, testcase, etc.
Gavin Barraclough
Comment 1
2011-07-05 14:26:01 PDT
This optimization now exists in YARR.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug