Happy Form History Expiration Day!

Over the last year, I’ve slowly been poking at Firefox’s form history implementation (aka “satchel”). Triaging the backlog of bugs, fixing some issues, and generally laying the groundwork for other exciting changes to come in Firefox.next. One notable change will start taking effect today or tomorrow (for Firefox 3.5 users) — the expiration of old, unused form history. A little background…

Back in November I implemented bug 463154, which added some additional data to the form history database. It now stores timestamps for when data was first added, when it was last used, and how many times it has been used. The first consumer of this data was the Clear Recent History dialog — we needed the timestamp to allow clearing the last hour (or whatever) of form history.

The first time you run a build with this change, all existing form history entries are assigned timestamps with the current time. So, if you were using Firefox trunk nightlies back in November 2008, you’ll have a bunch of entries with a first-used date set to around November 14th (the first nightly with this fix). Beta users got this in Firefox 3.1 Beta 2 (released December 8th), and it was also backported to Firefox 3.0.9 (released April 21st).

The second piece of background is that I recently fixed bug 243136, which adds support for expiring old form history entries. You might be surprised to learn that until this bugfix, we basically only removed form history entries when explicitly requested from the Clear Private Data dialog, or when a specific value was manually removed from the autocomplete dropdown by the user (hilight one and press delete or shift-delete!). Now, once a day or so, form history entries that haven’t been used for a long time will be deleted. The maximum age is determined by the browser.history_expire_days preference, which defaults to 180 days.

Now, if you’re clever, you might notice that November 14th 2008 + 180 days = today. If you’re not clever, well, reread the last sentence. So, Happy Form History Expiration Day! Note that expiration can only happen with Firefox 3.5 Beta 4 (or newer). And the exact date expiration starts depends on when you first ran a Firefox build that included timestamp support… Other common Form History Expiration Days may begin on June 6th (Dec. 8th + 180 days), and October 18th (Apr. 21st + 180 days). The latter will be extra special, since that’s the case that will apply to the bulk of our 1/4 billion Firefox users (most of whom will hopefully have upgraded to Firefox 3.5 by then).

Why do form history expiration at all? Three main reasons: privacy, relevance, and performance. Privacy and relevance are fairly obvious — retaining data forever isn’t good practice, and data unused for 6 months is highly unlikely to be relevant in the future. Performance is interesting… In my personal profile, I currently have 27,600 form history entries, with 12,700 of those from Google searches alone! Trudging through all that data takes time; in some cases an autocomplete dropdown can take hundreds of milliseconds to appear on my laptop. If I expire the data older than 180 days, those numbers drop dramatically — 4,600 entries / 1,800 from Google. This will immediately help improve form autocomplete performance, and help allow us to do more complex queries in the future (to improve the relevancy of the autocomplete results that we offer — stay tuned!).