1 Apr 2008 gpoo   » (Master)

How many recent files does an application really need?

A few days ago, Claudio wrote about the time Eog spent saving the filename of the recenly used image into ~/.recently-used.xbel. The reason: ~/.recently-used.xbel was too big. If I remember correctly, the FileChooser used to have a similar issue in the past.

Passing from 5.8 MiB to 1.8 MiB, through deleting all those items whose files does not exists, seems a bit gain. I wanted to go a bit further and I wondered ¿How many recent files does an application really need? (sorry, not that futher :-) I do not think more than 10, but let me know if I am wrong.

I wrote my own version of <a href=”http://www.gnome.org/~csaavedra/news-2008-03.html#D23″>Claudio’s program</a> with considering that matter. And my ~/.recently-used.xbel file went from 1.2 MiB to 54 KiB. Before to go to the script, let me show the numbers I got in a computer with less than two month of non intensive use:

gpoo@pendragon:~$ python clean-recently-used.py -v
Summary:
     1 Reproductor de películas Totem
     1 Glade
     4 GNU Image Manipulation Program
     4 Navegador web
     9 Visor de documentos Evince
     9 File Roller
    14 Web Browser
    15 Gnumeric Spreadsheet
    26 gedit
    34 Administrador de archivos
    36 Evince Document Viewer
    52 Totem Movie Player
   292 File Manager
  1151 Eye of GNOME Image Viewer

When I load Eog, it only show me the last 5 files I opened before. Why does it need 1146 extra items stored?

Nevermind. The <a href=”http://www.gnome.org/~gpoo/bag/clean-recently-used.py”>script</a> I wrote is simple. It delete the files that does not exists (the same strategy as Claudio’s program), but it also delete the files that are not so recently used, and I got the following numbers:

gpoo@pendragon:~$ python clean-recently-used.py -v
Summary:
     1 Glade
     3 GNU Image Manipulation Program
     4 Navegador web
     8 File Roller
     9 Visor de documentos Evince
    10 Totem Movie Player
    10 Eye of GNOME Image Viewer
    10 Web Browser
    10 Gnumeric Spreadsheet
    12 Evince Document Viewer
    13 Administrador de archivos
    14 gedit
    41 File Manager

Now you can put the <a href=”http://www.gnome.org/~gpoo/bag/clean-recently-used.py”>script</a> to be executed when you start your session or you can program a cron task to do it.

You can play with the script using it just with -v, which will give you only a summary of use.

And it is slow when delete items (in seconds), but much better when it is controlled.

Syndicated 2008-04-01 07:01:33 from Germán Poó-Caamaño

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!