Closed Bug 726442 Opened 8 years ago Closed 8 years ago
[meta] Run the CC less often by removing childless nodes from the purple buffer
In bug 725377, Gregor noticed that the cycle collector runs every 5 seconds. Using bug 726252, I noticed that this was due entirely due to childless nodes being added to the purple buffer. Childless nodes in the cycle collector graph can't be part of a garbage cycle. Because of this, we don't need to suspect them. Due to incomplete unlinking, we still may want to add them to the CC graph, should some other suspected node reach them and turn out to be garbage. These nodes don't have a particularly huge impact on the size of the graph: their primary negative impact is causing the CC to run more often. We can give these classes a CanSkip (which decides when to remove things from the purple buffer in between CCs) and maybe a CanSkipInCC (which decides when to remove things from the purple buffer at the start of a CC), but leave their CanSkipThis behavior alone (which decides when a node should be added to the CC graph).
Another category of things we can remove from the purple buffer are XPConnect roots: they are going to be added anyways, so there's no need to remember them in the purple buffer.
Here are the top childless nodes that show up in the purple buffer, from scrolling around on TechCrunch: 72 nsDOMCSSAttributeDeclaration 174 nsGenericElement (XUL) 93 nsDOMCSSAttributeDeclaration 67 nsBindingManager 52 nsDOMAttributeMap 682 nsDOMEvent 264 nsGenericElement (XUL) 95 nsEventStateManager 94 nsBindingManager 171 nsDOMCSSAttributeDeclaration 138 nsGenericElement (XUL) 89 nsBindingManager 82 nsBaseContentList 60 nsDOMAttributeMap 80 nsBindingManager This is with my fix for nsComputedDOMStyle and ChildContent.
Was there a GC before CC when nsDOMEvent showed up in the purple buffer?
...since I would expect DOMEvents to be deleted right after gc.
I don't know, sorry.
P1 because I think we can pick up some easy wins here. We're pretty bad right now about how often we run the CC (even though it is faster), and knocking out 3 or 4 of these junky classes from the purple buffer could help a lot.
Whiteboard: [Snappy] → [Snappy:P1]
https://tbpl.mozilla.org/?tree=Try&rev=7664fb2957e4 Try run that adds purple buffer removal for childless nsComputedDOMStyles, nsChildContentList and nsDOMCSSAttributeDeclaration.
Should be fixed completely by bug 728460. We can still come up with other clever ways to remove boring things from the purple buffer, but CCs triggered by GCs are probably a bigger issue.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.