[PATCH] Use cached XKB keymap when rules haven't changed

Daniel Stone daniel at fooishbar.org
Sun Nov 23 23:52:39 PST 2008


On Sun, Nov 23, 2008 at 06:06:54PM -0800, Dan Nicholson wrote:
> Rather than compiling a new keymap every time XkbInitKeyboardDeviceStruct
> is called, cache the previous keymap and reuse it if the rules have not been
> changed. When XkbSetRulesDflts is called, the cached map is invalidated if
> it differs from the previous default rules.
> 
> The map is also invalidated if named components are supplied. This could be
> fixed by caching Ktcsg from the previous run and comparing.
> 
> Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
> ---
>  This takes Peter's suggestion and just copies the internal keymap structs
>  when there aren't any changes. It seems to work in my testing and for all
>  the cases I can think of.
> 
>  I plan to do some actual profiling to see what the effects are, but it
>  seems like a win to not just blindly fork xkbcomp unless necessary.

Shiny.  This might have a small impact on startup time, too.  Untested,
but looks okay (was concerned that it might have still directly assigned
rather than copied, but all good).

Signed-off-but-not-tested-by: Daniel Stone <daniel at fooishbar.org>

I don't think caching KcCGST is really worth it.

Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20081124/4b7293d3/attachment.pgp>


More information about the xorg mailing list