Closed Bug 378390 Opened 18 years ago Closed 18 years ago

Use a bit to track whether the binding manager has a pointer to an element

Categories

(Core :: XBL, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Assigned: smaug)

References

Details

Attachments

(1 file, 1 obsolete file)

See bug 377787 comment 4. Maybe we should use a bit to keep track of whether it's even worth looking in the binding manager's hashtable when traversing a generic element? After all, usually it's not.
Blocks: 377787
Attached patch possible patch (obsolete) (deleted) — Splinter Review
Haven't profiled this properly, but nsBindingManager::Traverse seems to get called quite often even when manager doesn't have anything pointing to aContent. I got pretty easily something like 15000 extra calls during cc which with the patch become faster because of the early return. All the bit handling is in nsBindingManager to keep things easier to understand and maintain.
Assignee: general → Olli.Pettay
Status: NEW → ASSIGNED
Attachment #263740 - Flags: superreview?(peterv)
Attachment #263740 - Flags: review?(peterv)
Summary: Use a bit to track whether an element has a binding in the binding table → Use a bit to track whether the binding manager has a pointer to an element
Note that with sicking's patch to short-circuit traversal of currently-displayed documents this may not be as much of a problem anymore...
GetBinding is called very often and quite often mBindingTable.IsInitialized() is true, so testing the flag should safe some time. At least it saves some 150000 calls to mBindingTable.GetWeak when loading ~25 pages from BBC to different tabs and closing the browser.
Attachment #263740 - Attachment is obsolete: true
Attachment #263760 - Flags: superreview?(peterv)
Attachment #263760 - Flags: review?(peterv)
Attachment #263740 - Flags: superreview?(peterv)
Attachment #263740 - Flags: review?(peterv)
After Bug 378987 nsBindingManager::Traverse gets called a lot less. It is called now mainly during shutdown, but also occasionally when running for example Tdhtml. The patch should however speed up GetBinding, so I'd like to try it (and maybe back it out if nothing gets faster).
Comment on attachment 263760 [details] [diff] [review] check the bit also in GetBinding >Index: content/xbl/src/nsBindingManager.cpp >=================================================================== > nsXBLBinding* > nsBindingManager::GetBinding(nsIContent* aContent) > { >- if (mBindingTable.IsInitialized()) >+ if (aContent && aContent->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR) && Do we really need to check for null aContent? > void > nsBindingManager::Traverse(nsIContent *aContent, > nsCycleCollectionTraversalCallback &cb) > { >+ if (!aContent->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) { >+ return; >+ } >+ > nsXBLBinding *binding = GetBinding(aContent); > if (binding) { Maybe we should just return if GetBinding returns null? I'm ok with trying this, but if it doesn't help I'd rather back it out and free the flag for something else.
Attachment #263760 - Flags: superreview?(peterv)
Attachment #263760 - Flags: superreview+
Attachment #263760 - Flags: review?(peterv)
Attachment #263760 - Flags: review+
(In reply to comment #5) > > Do we really need to check for null aContent? I think I saw some crashes without it. I'll double check. > Maybe we should just return if GetBinding returns null? > That wouldn't work, binding manager has also other references than just content->binding
I think this dropped tp2 and tdhtml a bit on bl-bldlnx01/argo-vm and bl-bldxp01/fx-win32-tbox (as I expected). The change isn't big, so might be within the noise. Leaving the patch in for now.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: