Closed Bug 827392 Opened 7 years ago Closed 2 years ago

Reduce ForgetSkippable pause times

Categories

(Core :: XPCOM, defect)

defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: mccr8, Assigned: mccr8)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Whiteboard: [Snappy])

Attachments

(1 file)

We've moved a lot of CC work into ForgetSkippable, which is good, but now ForgetSkippable pauses can be as long as CC pauses now, so we should investigate where the time is being spent, and figure out how to reduce that.

My guess is that the longest pauses are in that first ForgetSkippable call after a GC, due to all the UnmarkGray cleanup we do. If that's the case, then we should figure out how we can make more of the obviously-live JS get marked black instead of gray. One way to do this would be to take a snapshot of the JS heap before and after the ForgetSkippable call, and look at the objects that changed color.
Usually max forgetskippable time is significantly lower than CC.
Median time is 3ms.

The first 2 forgetSkippables after GC are the most important and yeah, I'd assume the first one
is the slowest one.
As expected, most of the time (but not all) was being spent in nsCCUncollectableMarker::Observe. Here's a patch to add some basic timing.

Here are some results for those taking more than 1ms:

cc: MarkWindowList mediator took 2302us
cc: MarkWindowList watcher took 939us
cc: AppShellService took 29us
cc: xulCache took 1995us
cc: CleanupJS took 2253us
cc: TOTAL took 7564us

cc: MarkWindowList mediator took 1046us
cc: MarkWindowList watcher took 980us
cc: AppShellService took 13us
cc: xulCache took 89us
cc: UnmarkSkippableJSHolders took 566us
cc: TOTAL took 2719us

cc: MarkWindowList mediator took 410us
cc: MarkWindowList watcher took 58us
cc: AppShellService took 34us
cc: xulCache took 1136us
cc: CleanupJS took 1171us
cc: TOTAL took 2855us

cc: MarkWindowList mediator took 360us
cc: MarkWindowList watcher took 40us
cc: AppShellService took 27us
cc: xulCache took 1014us
cc: CleanupJS took 1326us
cc: TOTAL took 2811us

cc: MarkWindowList mediator took 369us
cc: MarkWindowList watcher took 53us
cc: AppShellService took 29us
cc: xulCache took 1784us
cc: CleanupJS took 1155us
cc: TOTAL took 3430us
I looked at XULCACHE first, as that is probably easier to fix. It has two parts, XBL and XUL.  It seems to be mostly XBL, though if they tend to hold onto the same objects, then it will just be a matter of XBL going first.

cc: 	MarkXBLInCCGeneration took 1119us
cc: 	MarkXULInCCGeneration took 12us
cc: xulCache took 1140us

cc: 	MarkXBLInCCGeneration took 127us
cc: 	MarkXULInCCGeneration took 7us
cc: xulCache took 142us

cc: 	MarkXBLInCCGeneration took 103us
cc: 	MarkXULInCCGeneration took 7us
cc: xulCache took 119us

cc: 	MarkXBLInCCGeneration took 854us
cc: 	MarkXULInCCGeneration took 12us
cc: xulCache took 876us
Depends on: 827534
Detailed time spent in cleanupJS:
cc: CleanupJS:UnmarkGrayJSListeners took 619us
cc: CleanupJS:MarkMessageManagers took 134us
cc: CleanupJS:UnmarkGrayStrongObservers took 323us
Quite a few of these must happen right after MarkWindowList* so that documents are in CC generation.
XUL/XBL cache and observer stuff marking doesn't need that, and could happen (perhaps async) right
after GC, or even during GC.
Bug 827534 eliminates most of the xulCache problems. We could do a similar thing for the observer stuff, make it marked black instead of relying on unmarkGray. That would reduce the amount of work we do, in addition to reducing pauses.
Whiteboard: [Snappy]
Summary: Investigate time spent in ForgetSkippable → Reduce time spent in ForgetSkippable
Assignee: nobody → continuation
Depends on: 717500, 791127
Depends on: 1020622
Depends on: 1097302
Summary: Reduce time spent in ForgetSkippable → Reduce ForgetSkippable pause times
Depends on: 868139
This is probably good enough for now...
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.