[PATCH] xkb: Check and load precompiled .xkm during startup if available

Dan Nicholson dbn.lists at gmail.com
Tue Mar 16 06:04:24 PDT 2010

On Mon, Mar 15, 2010 at 5:12 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> On Tue, Mar 16, 2010 at 04:45:51AM +0600, Mikhail Gusarov wrote:
>> New 'precompiled' subdir is added to xkb data dir, allowing to pre-compile
>> keymaps to be loaded when server starts and hence avoid running xkbcomp, saving
>> a bit of time.
> Good idea. Do you have any numbers on how much time this actually saves?
> IIRC we only run xkbcomp once at the moment and then re-used the cached
> values. Is skipping this one run beneficial?

When I was profiling this before for the caching patch, the initial
run hurt. Especially since it was synchronous because it was for the
core keyboard and was then part of the init process. On my machine it
was about 0.5 seconds on a cold start:


> What happens if xkeyboard-config is updated after an xkm has been
> precompiled? Do the users need to recompile? This is my main worry, it'll
> make triaging of nonworking keyboard layouts quite tricky.

You could stat the xkb directory or the rules file and skip the xkm
file if it was older. For real crack, you could rebuild the xkm file
if newer xkb files are found, but this would break for people who
explicitly built the keymap on another host.

I don't think there's any way to be smart and safe here. I think the
best you could do is document this option as "use at your own risk"
and spit a warning in the log if the xkm file appears to be older than
the xkb-config files.


More information about the xorg-devel mailing list