diff options
author | Ran Benita <ran@unusedvar.com> | 2021-03-28 15:51:01 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2021-03-28 16:11:36 +0300 |
commit | 7d84809fdccbb5898d0838849ec7c321410182d5 (patch) | |
tree | 76b6db4cdb32caf1918738bee31e1797fc123bd9 /scripts | |
parent | 3b506497bf9033124ce71150719325c6f2ddcf75 (diff) | |
download | xorg-lib-libxkbcommon-7d84809fdccbb5898d0838849ec7c321410182d5.tar.gz |
keysym: fast path for case sensitive xkb_keysym_from_name
xkb_keysym_from_name() is called a lot in Compose file parsing. The
lower case handling slows things down a lot (particularly given we can't
use the optimized strcasecmp() due to locale issues). So add separate
handling for the non-case-sensitive case which is used by Compose.
To do this we need to add another version of the ks_tables table. This
adds ~20kb to the shared library binary. We can probably do something
better here but I think it's fine.
Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/makekeys | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/makekeys b/scripts/makekeys index f6a0280..e12925e 100755 --- a/scripts/makekeys +++ b/scripts/makekeys @@ -46,6 +46,10 @@ def print_entries(x): print(' {{ 0x{value:08x}, {offs} }}, /* {name} */'.format(offs=entry_offsets[name], value=value, name=name)) print('static const struct name_keysym name_to_keysym[] = {') +print_entries(sorted(entries, key=lambda e: e[0])) +print('};\n') + +print('static const struct name_keysym name_to_keysym_icase[] = {') print_entries(sorted(entries, key=lambda e: e[0].lower())) print('};\n') |