Bug 15902 - 15% of string-validate-input.js is spent compiling the same regular expression
Summary: 15% of string-validate-input.js is spent compiling the same regular expression
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords:
: 15900 (view as bug list)
Depends on: 15861
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-08 14:09 PST by Geoffrey Garen
Modified: 2007-11-11 20:31 PST (History)
2 users (show)

See Also:


Attachments
Patch (8.68 KB, patch)
2007-11-09 11:42 PST, Geoffrey Garen
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2007-11-08 14:09:02 PST
A short history:

In bug 15861, we concluded that, for compatibility with Firefox and ECMA3, we should create a single, persistent RegExpImp (JS wrapper) per regular expression literal in the AST.

However, IE6 creates a new JS wrapper each time the regular expression literal is evaluated. Also, Firefox's behavior has caused many compatibility problems. (See https://bugzilla.mozilla.org/show_bug.cgi?id=98409.) And, as a result of these facts, the current draft of ECMA4 contradicts ECMA3 and specifies the IE6 behavior. (See http://www.ecmascript.org/es4/spec/incompatibilities.pdf.)

So, I don't think we should create a single, persistent RegExpImp (JS wrapper) per regular expression literal in the AST.

However, building on the work in bug 15861, I think we can store a compiled RegExp in the AST, for a performance win.
Comment 1 Eric Seidel (no email) 2007-11-08 14:11:20 PST
I think perhaps we should dup bug 15900 to this one :)

Got to love web compatibility!
Comment 2 Geoffrey Garen 2007-11-08 15:48:41 PST
*** Bug 15900 has been marked as a duplicate of this bug. ***
Comment 3 Geoffrey Garen 2007-11-09 11:42:26 PST
Created attachment 17159 [details]
Patch
Comment 4 Geoffrey Garen 2007-11-11 20:31:03 PST
Committed revision 27702.