Comment 37 for bug 635223

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

I want to clear up the reason why I am hesitating a bit to jump right into this. Not saying we shouldn't fix it, definitely we should! Just that I am hesitating, to contemplate it a bit.

The XDG desktop file spec (or is it the menu spec?) dictates that to compute the desktop file id of something nested in the applications dir you substitute all slashes "/" for dashes "-". So fx. ~/.local/share/applications/wine/Programs/Songbird/Songbird.desktop has desktop file id wine-Programs-Songbird-Songbird.desktop. So when we look it up by id we need to check 8 permutations of / and - (in the worst case). That is 8 stat()s instead of 1.

The big problem is that in order to be 100% consistent we must support this on *all* .desktop files with - in the basename, not just wine files. I quick series of shell commands show that I have 727 -s in desktop file names in /usr/share/applications and /usr/share/app-install/desktop in total. The number of needed (worst case) permutations is prolly a bit bigger becomes some files have more than one - in the name; so roughly maybe around 1000k extra stat() calls.

Needless to say; we can apply a lot of tricks to get *well* below the worst case number of 1k extra stat()s; but it goes to show that the XDG spec is particularly bad at this point, and it's not something we should just dive into head first. It may give a non-trivial impact on startup performance.