Closed Bug 406671 Opened 13 years ago Closed 13 years ago

nsWindowSH::GetProperty() is slow.

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9beta2

People

(Reporter: jst, Assigned: jst)

References

Details

(Keywords: perf)

Attachments

(1 file)

nsWindowSH::GetProperty() is showing up pretty high in profiles, and can be made faster. The biggest offender is the call to XPConnect's GetWrappedNativeOfJSObject(), which we call to check if the cached property value is a window object, and we do that so that the wrappers (XPCSafeJSObjectWrapper and XPCCrossOriginWrapper) can do the proper wrapping of the values. We can trivially avoid most of the calls into GetWrappedNativeOfJSObject() by checking if the JSClass name is such that the value is likely to be a window, and only then do the expensive call. This shaves off about 9% of the XPConnect overhead as seen in bug 375225.

Patch coming up.
Attachment #291329 - Flags: superreview?(peterv)
Attachment #291329 - Flags: review?(peterv)
Comment on attachment 291329 [details] [diff] [review]
Don't call GetWrappedNativeOfJSObject unless we're likely to find what we need.

>diff --git a/dom/src/base/nsDOMClassInfo.cpp b/dom/src/base/nsDOMClassInfo.cpp

>+    if ((*name == 'W' && strcmp(name, "Window") == 0) ||
>+        (*name == 'C' && strcmp(name, "ChromeWindow") == 0)) {

This needs to handle ModalContentWindow too. Maybe add a comment to make it clear that it is vital to keep this list up-to-date.
Attachment #291329 - Flags: superreview?(peterv)
Attachment #291329 - Flags: superreview+
Attachment #291329 - Flags: review?(peterv)
Attachment #291329 - Flags: review+
Fix checked in.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
Keywords: perf
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.