Closed Bug 726509 Opened 12 years ago Closed 11 years ago

[CC] investigate ClearGraph() times

Categories

(Core :: XPCOM, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: mccr8, Unassigned)

References

(Blocks 1 open bug)

Details

For reasons I don't understand, this sometimes takes a pretty big chunk of time:

cc: MarkRoots() took 76ms
cc: ScanRoots() took 1ms
cc: CollectWhite::Unroot took 1ms
cc: CollectWhite() took 1ms
cc: ClearGraph() took 107ms
cc: total cycle collector time was 199ms
cc: visited 16548 ref counted and 9615 GCed objects, freed 1377.

This includes clearing the white node array, clearing the nodes and edges, and the weak maps.

That 107ms is pretty rare, but I see it taking 10ms or so fairly often, out of 70ms or so.  Of course, it also frequently takes almost no time.

It would be good to figure out why it varies so much.  I'd expect the time to be proportional to the length of MarkRoots (eg the size of the graph) but it doesn't seem to be.

In theory we should be able to do that clearing a little later, at the cost of increasing the memory footprint of the CC.  Of course, it is probably better to just figure out why it is taking so long sometimes.
Very strange.
This looks like it is mostly mNodes clearing, though sometimes mEdges.

cc: ForgetSkippable() took 15ms
cc: mRuntimes[*]->BeginCycleCollection() took 5ms
cc: MarkRoots() took 30ms
cc: ClearGraph()::mNodes took 27ms
cc: total cycle collector time was 67ms
cc: visited 12990 ref counted and 4934 GCed objects, freed 285.

It still isn't clear to me why it is so slow on one CC, then in the very next one it doesn't show up at all.  Freeing large chunks of memory must just hit a slow path sometimes.
Perhaps taras or glandium knows.
What these functions do is free 2 or 3 blocks of about 250k each.  Sometimes it takes less than 2ms, sometimes it takes 30ms or more.
No longer blocks: 698919
Blocks: 698919
Not a big deal...
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.