[meta] Run the CC less often by removing childless nodes from the purple buffer

RESOLVED FIXED

Status

()

Core
XPCOM
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: mccr8, Unassigned)

Tracking

(Blocks: 1 bug)

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [Snappy:P2])

(Reporter)

Description

6 years ago
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).
(Reporter)

Updated

6 years ago
Depends on: 726331, 726340
(Reporter)

Comment 1

6 years ago
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.
(Reporter)

Updated

6 years ago
Depends on: 726252
(Reporter)

Comment 2

6 years ago
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.

Comment 3

6 years ago
Was there a GC before CC when nsDOMEvent showed up in the purple buffer?

Comment 4

6 years ago
...since I would expect DOMEvents to be deleted right after gc.
(Reporter)

Comment 5

6 years ago
I don't know, sorry.
(Reporter)

Comment 6

6 years ago
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]
(Reporter)

Comment 7

6 years ago
https://tbpl.mozilla.org/?tree=Try&rev=7664fb2957e4
Try run that adds purple buffer removal for childless nsComputedDOMStyles, nsChildContentList and nsDOMCSSAttributeDeclaration.
(Reporter)

Updated

6 years ago
Depends on: 727572
(Reporter)

Updated

6 years ago
Depends on: 727625
(Reporter)

Updated

6 years ago
Depends on: 728460
(Reporter)

Updated

6 years ago
Whiteboard: [Snappy:P1] → [Snappy:P2]
(Reporter)

Comment 8

6 years ago
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
Last Resolved: 6 years ago
Resolution: --- → WORKSFORME
(Reporter)

Updated

6 years ago
Resolution: WORKSFORME → FIXED
No longer blocks: 698919
Blocks: 698919
You need to log in before you can comment on or make changes to this bug.