Closed
Bug 519608
Opened 15 years ago
Closed 15 years ago
Is it worth optimizing for the inline style case in nsCSSStyleDeclSH::PreCreate?
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(1 file)
4.79 KB,
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
Right now, nsCSSStyleDeclSH::PreCreate does this: jsval v; nsresult rv = WrapNative(cx, globalObj, native_parent, PR_FALSE, &v); NS_ENSURE_SUCCESS(rv, rv); But in almost all cases, |native_parent| is an Element (HTML/SVG/XUL) and already has a wrapper (and in fact, we're just getting a property off that wrapper). This only matters the first time we wrap a given CSSDeclaration, but that time this WrapNative call is almost half of our slimwrapper construction time. Would it make sense to optimize for the case when native_parent implements nsWrapperCache and can just hand out a jsobject, falling back on WrapNative if for some reason (e.g. someone manually tried to wrap a CSSDeclaration from C++) that's not the case?
Assignee | ||
Comment 1•15 years ago
|
||
I think this should be safe, since wrapper-cached stuff doesn't care about the scope you passed in (certainly not once the wrapper is created), right? It certainly speeds up my testcase (which does lots of creating nodes and setting style on them) up by 3% or so.
Assignee | ||
Comment 2•15 years ago
|
||
I guess we could nix the QI to nsWrapperCache too, by changing the relevant GetParentObject signatures to return nsINode. That won't work if we ever start wrapper-caching CSSStyleRule declarations, though.
Comment 3•15 years ago
|
||
Comment on attachment 403693 [details] [diff] [review] Maybe like so We could even avoid the QI for some of these parents (for example nsINode inherits from nsWrapperCache, no need to QI if we have an nsINode). We'd have to change some of the functions that get the parent object to return a more specific interface.
Attachment #403693 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 4•15 years ago
|
||
Right; that's what I said in comment 2. Do you want me to do that?
Assignee | ||
Comment 5•15 years ago
|
||
Pushed http://hg.mozilla.org/mozilla-central/rev/4e46887f17bc Do we want a separate bug on comment 2?
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Comment 6•15 years ago
|
||
(In reply to comment #4) > Right; that's what I said in comment 2. Do you want me to do that? Sorry, I just read the request bugmail before reviewing. (In reply to comment #5) > Do we want a separate bug on comment 2? Yeah, the QI will probably not stick out in a profile, but it might at some point.
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•