lxde/lxqt-panel — pull request #80 by PCMan (2014-09-04 17:36:09+00:00)
Title: Avoid using XdgDesktopFileCache to speed up program startup by 20%.

The original coded use XdgDesktopFileCache::getFile() to load the desktop files for the quick launch buttons.
When this method is called the first time, it tries to search for all *.desktop files installed in the system.
This large amount of I/O can block program startup for several seconds.
I use callgrind to profiling lxqt-panel and it showed that this cost 20-23% of total execution time, which is quite a lot.
The intention of using this is, the mainmenu plugin also needs to load all app desktop files.
So quick launch and mainmenu can share the cache and reduce I/O. However, this is still slow.
When compiled with menu-cache support, mainmenu plugin loads a cached version of app menu without parsing any *.desktop files.
Unless the cache is invalidated and requires reload, this is a very fast operation.
In this case, mainmenu no longer need the XdgDesktopFileCache, so loading all app dirs just to look up several files for quicklaunch becomes the bottle neck of lxqt-panel startup.

In this patch, I load the desktop files directly instead of searching in the cache. This actually is much faster because:
1. When menu-cache is enabled, we avoid loading all *.desktop files and only load what we need, so it's much faster.
2. When menu-cache is disabled, all *.desktop files are just read by the mainmenu plugin so these files are still in the filesystem cache of the OS. So loading these files again from quicklaunch is still as fast even without our own cache.
3. If the user does not use mainmenu and only uses quicklaunch plugin, then it's the same as case #1, so it's still faster.

Please help review and test the patch and hopefully you can accept it.
Thank you.