Closed Bug 666340 Opened 13 years ago Closed 5 years ago

Serialize the memory cache on shutdown


(Firefox for Android Graveyard :: General, defect)

Not set


(Not tracked)



(Reporter: cwiiis, Unassigned)


(Keywords: perf)


(3 files, 3 obsolete files)

User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:7.0a1) Gecko/20110622 Firefox/7.0a1
Build Identifier: 

We can probably reduce page-load time and bandwidth use slightly if we serialize the memory cache on shut-down, and deserialize it on startup. This ought to help with restart speed to, when restoring tabs.

This may work quite nicely in addition to a disk cache (bug #645848).

Reproducible: Always
This patch serializes the memory cache on memory-pressure and on shutdown, and deserializes when initialising the session store (which happens before restoring the session).

Probably not really ready for review yet.
Just a note, this doesn't seem hugely effective unless you increase the memory cache size (browser.cache.memory.capacity) - I find 4 megs seems to give more reasonable results (the default is 1).

Perhaps we could have a more intelligent eviction algorithm? (I notice in my cache that a lot of ads and ad-related content gets cached vs. main page resources)
(In reply to comment #2)
> Perhaps we could have a more intelligent eviction algorithm? (I notice in my
> cache that a lot of ads and ad-related content gets cached vs. main page
> resources)

Be aware of bug 661900 -- this *might* be contributing to your eviction problem.
Updated patch.

This version also uses the browser.cache.check_doc_frequency pref when restoring the last session to (hopefully) stop from verifying cache entries. The pref is reset once the page has finished loading or is stopped.

Not sure if this is a good idea or not, ideally there'd be a way to do what this pref does on a per-tab basis.
Attachment #541155 - Attachment is obsolete: true
This patch adds an extra startup option that allows you to restore the last session. Probably not that desirable on a phone perhaps, but I like this option on a tablet.
Attached file Part 3 - Add compatibility with bug (obsolete) —
This patch tweaks the serialization slightly to take advantage of the cache compression provided in bug #648429.
Attachment #541966 - Attachment is obsolete: true
Ever confirmed: true
Keywords: perf
Assignee: nobody →
Whoops, the optional session restore didn't work because the preference wasn't added by default.
Attachment #541964 - Attachment is obsolete: true
Just to note, it's only the first hunk of that patch that's relevant to this, you could just apply that and ignore the rest.
ugh, ignore last comment, wrong bug.
Just checking back on this, is memory cache serialization something we want? Our default memory cache size is only 1meg, so it barely helps in that situation, but coupled with an increased size of 4 megs and perhaps memory cache compression, you might be looking at saving some precious bandwidth.

It has no considerable effect on loading times, as far as I can see, in practical situations at least, so I think this should be considered purely on its saving-bandwidth potential (at the expense of storage space).

I think this would also be superseded by the work on getting disk cache usable on mobile too.

I don't think I'm the right person to be dealing with this, unassigning.
Assignee: → nobody
Closing all opened bug in a graveyard component
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.