Wednesday, April 23, 2008

Magic Trick

Magic trick for Kubuntu users:

1. Make an empty new directory ~/.compose-cache
2. Start a KDE application which has a text input widget (anything with a line edit or editable combo box will do)
3. Check ~/.compose-cache, it should now have a file in it whoose name is a long string of numbers

All being well, your Qt/KDE/Gtk applications should now start up 50-150ms faster.

Users of other distros are welcome to give it a try, I have only been able to test directly on Kubuntu. If you have a non-empty /var/cache/libx11/compose folder (eg. SuSE users) then this optimization is already enabled so you don't need to do anything.

For those curious about what is going on here, this enables an optimization which Lubos (of general KDE speediness fame) came up with some time ago and was then rewritten and integrated into libx11. Ordinarily on startup applications read input method information from /usr/share/X11/locale/<your locale>/Compose. This Compose file is quite long (>5000 lines for the en_US.UTF-8 one) and takes some time to process. libX11 can create a cache of the parsed information which is much quicker to read subsequently, but it will only re-use an existing cache in /var/cache/libx11/compose or create a new one in ~/.compose-cache if the directory already exists.

Relevant freedesktop.org bug report

15 comments:

Anonymous said...

Neat trick. It's magically delicious!

Anonymous said...

I filed a bug at https://bugs.edge.launchpad.net/ubuntu/+source/libx11/+bug/221065.

Anonymous said...

Works on Mandriva 2008.1, too :-)
Thx

Anonymous said...

Sounds like voodoo but it works (of course on GNOME too when you open a KDE-App)

Anonymous said...

On Suse 10.3 /var/cache/libx11/compose allready exists, so I can assume this nice feature is allready in use here :-)

Mick T. said...

Thanks for the tip. :)

Mick

Anonymous said...

Neat!

Sudipta Das said...

Hi people, I love magic very much. What is a good street magic book that doesn't require gimmicks? I found a website link but I am not sure if I should trust Master Mentalist or not, because it looks somewhat fake. Does anyone know of a good magic book that enables me to do tricks unexpectedly without having a gimmick set up? Thanks a lot for any helpful comments.

sudipta das
____________
magic card tricks

Galbi said...

Worked fine in Tuquito 2.0r5 (Debian based Argentinian distro)

Thanks.

MagicShops said...

Nice trick! I'm a fan of magic trick, I spend a lot of time watching them on DVDs that I buy from magic shops!

costa rica hotels said...

hi guys ... I was very pleased to read the information in this article ... was of great interest and would love to get a lot more information about "Magic Trick"

www.sofas.nom.es said...

This will not have effect in fact, that's exactly what I suppose.

Anonymous said...

Thanks for the trick.
Is it works with other desktop environments, like lxde?

facebook se paise kaise kamaye said...

Learn to make money with facebook or facebook se paise kaise kamaye - How to Make money Online

Unknown said...

Great tip.. learn and interact more with people on this forum www.kd3v.com now