diff options
author | Ran Benita <ran@unusedvar.com> | 2020-11-19 00:28:37 +0200 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-11-20 13:04:21 +0200 |
commit | 1bd3b3c7cb52ae77667d45cb46e8b5af3046a8d7 (patch) | |
tree | 067bb54b2daf23dcef11c24aed3ac8b65f8c4d9c /src/context.h | |
parent | f41e609bbea8447fc82849a1a6ea0d116189f2f8 (diff) | |
download | xorg-lib-libxkbcommon-1bd3b3c7cb52ae77667d45cb46e8b5af3046a8d7.tar.gz |
x11: cache X11 atoms
On every keymap notify event, the keymap should be refreshed, which
fetches the required X11 atoms. A big keymap might have a few hundred of
atoms.
A profile by a user has shown this *might* be slow when some intensive
amount of keymap activity is occurring. It might also be slow on a
remote X server.
While I'm not really sure this is the actual bottleneck, caching the
atoms is easy enough and only needs a couple kb of memory, so do that.
On the added bench-x11:
Before: retrieved 2500 keymaps from X in 11.233237s
After : retrieved 2500 keymaps from X in 1.592339s
Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'src/context.h')
-rw-r--r-- | src/context.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/context.h b/src/context.h index ead2508..44367cc 100644 --- a/src/context.h +++ b/src/context.h @@ -45,6 +45,9 @@ struct xkb_context { struct atom_table *atom_table; + /* Used and allocated by xkbcommon-x11, free()d with the context. */ + void *x11_atom_cache; + /* Buffer for the *Text() functions. */ char text_buffer[2048]; size_t text_next; |