summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2021-03-28 20:22:54 +0300
committerRan Benita <ran@unusedvar.com>2021-04-01 20:06:59 +0300
commit68e69b7deb8d0d38758a7a68c76892b90e3fccc9 (patch)
tree04f9a0d3c4b34d86f8a8694b16c5845c96cca7c3 /test
parent02b9cabf9827dd004912fb0b002c2a37a1aa90e0 (diff)
downloadxorg-lib-libxkbcommon-68e69b7deb8d0d38758a7a68c76892b90e3fccc9.tar.gz
keysym: use a perfect hash function for case sensitive xkb_keysym_from_name
In 7d84809fdccbb5898d0838849ec7c321410182d5 I added a fast path for the case-sensitive case, but it is still slowing down Compose parsing. Instead of the binary search, use a perfect hash function, computed with a simple python module I found (vendored). It is faster -- perf diff is: Baseline Delta Abs Shared Object Symbol ........ ......... ................. ................................... 22.35% -14.04% libc-2.33.so [.] __strcmp_avx2 16.75% +10.28% bench-compose [.] xkb_keysym_from_name 20.72% +2.40% bench-compose [.] parse.constprop.0 2.29% -1.97% bench-compose [.] strcmp@plt 2.56% +1.81% bench-compose [.] resolve_name 2.37% +0.92% libc-2.33.so [.] __GI_____strtoull_l_internal 26.19% -0.63% bench-compose [.] lex 1.45% +0.56% libc-2.33.so [.] __memchr_avx2 1.13% -0.31% libc-2.33.so [.] __strcpy_avx2 Also reduces the binary size: Before: text data bss dec hex filename 341111 5064 8 346183 54847 build/libxkbcommon.so.0.0.0 After: text data bss dec hex filename 330215 5064 8 335287 51db7 build/libxkbcommon.so.0.0.0 Note however that it's still larger than before 7d84809fdccbb5898d08388: text data bss dec hex filename 320617 5168 8 325793 4f8a1 build/libxkbcommon.so.0.0.0 Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions