I noticed very odd Firefox behavior on my WinXP box recently. Whenever I would attempt to download a file, the whole browser would freeze up for few seconds. It has been getting progressively worse as the days went by. Today I got fed up with it and decided to investigate. Quick google showed me that I’m an idiot – all I had to do was to clean my download list every once in a while.
You see, Firefox keeps the list of all your downloads in a file called downloads.rdf in your profile directory. Whenever you download new file, information such as file name, download date and etc it gets added to (wait for it..) the top o the file. In other words, whenever you download a file, Firefox needs to rebuild that file.
If you ever needed a proof that using XML based format such as RDF for logging purposes is not always a good idea, look no further. With a simple text based file, you could simply append to the file which is a relatively quick procedure. If you want to append to the top, you just rename the old file, create a new one and append the two. Easy! With XML it’s not this easy because your entries have shit above and below. So in most cases you need to parse the file, load it’s contents into memory and then write it back out.
My downloads.rdf file had like a billion entries, so no wonder Firefox was throwing up every time I was trying to download something. Solution is of course to clean your download list every once in a while. I wonder if this soft of behavior could be prevented. Perhaps accessing that file should be done in a separate thread (if it’s not already) or perhaps FF should purge old entries automatically after reaching some sort of threshold…
[tags]firefox, download.rdf, firefox freezing, browser, downloads[/tags]