Where my Firefox performance problem seems to be

November 20, 2012

I've written a fair amount before on how Firefox (doesn't) perform for me, but it's time for what will probably be the final update on this (since I don't expect the Firefox people to fix whatever the core problem is).

The short summary of my problem is garbage collection stalls. I was mostly lead to this by stumbling over the MemChaser addon (via), which shows the amount of time that Firefox pauses for garbage collection. When my Firefox session is new and its memory usage is low, these GC stalls are short, but as memory usage climbs they rapidly lengthen (when I have MemChaser active, I can watch its duration reports turn red over time). This correlates well with my observed symptoms of Firefox stalling on various operations when it gets bogged down. Outside of GC stalls performance is decent, but once the GC duration rises any time a collection happens things lurch to a pause.

(Of the two durations reported by MemChaser, cycle collection is usually significantly longer than garbage collection.)

This still leaves the question of why Firefox's steadily growing resident set size is having such a catastrophic effect on garbage collection times. I don't have an answer to that one. My impression is that Firefox can in general get up to over 1 GB of resident memory without melting down, but I say this mostly because Mozilla people seem more concerned about swapping than usability meltdowns.

(I can speculate about things like memory fragmentation, maybe involving lots of little objects and maybe caused by or increased by one of my addons, but I don't actually know. I'd be interested to know if people can run large Firefox sessions without GC stalls, say with MemChaser showing over a GB resident but with low collection durations.)

All of this has kept happening despite the Firefox 16 switch to incremental GC, and continues to happen both in Firefox 17 and in current nightly builds (which I've started trying out). Things have reached the point where I have to restart Firefox around once a day in order to keep it usable; fortunately I have tools to make that easier (plus Firefox's setting of 'on startup, show the windows from last time'). If I did not, I think I would be really angry at Firefox.

Note that MemChaser can be disabled and enabled on the fly without a Firefox restart. I find this very convenient since it takes up precious bottom status bar space when enabled (and worse, a variable amount of space).

PS: These days I don't seem to have any significant amount of zombie compartments or obvious memory leaks. To the extent that I can spot any significant memory growth in about:memory, it seems to be in compiled JavaScript code.

Written on 20 November 2012.
« Python 3's print() annoys me (although maybe it shouldn't)
The varying appeal of wikitext and other simple markup »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Tue Nov 20 00:21:45 2012
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.