summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2021-03-29 16:05:14 +0300
committerRan Benita <ran@unusedvar.com>2021-03-31 12:10:52 +0300
commit02b9cabf9827dd004912fb0b002c2a37a1aa90e0 (patch)
tree68366cff22aea14237138d1f38ac88ff61ee4121 /scripts
parent3a6c3b2c48614d6ce94cc89a349c3f422e429931 (diff)
downloadxorg-lib-libxkbcommon-02b9cabf9827dd004912fb0b002c2a37a1aa90e0.tar.gz
compose: use a ternary tree instead of a regular trie
Previously we used a simple trie with a linked list for each chain. Unfortunately most compose files have very long chains which means the constructions performs an almost quadratic number of comparisons. Switch to using a ternary search tree instead. This is very similar to a trie, only the linked list is essentially replaced with a binary tree. On the en_US/Compose file, the perf diff is the following (the modified function is `parse`): Event 'cycles:u' Baseline Delta Abs Shared Object Symbol ........ ......... ................ ................................. 39.91% -17.62% bench-compose [.] parse.constprop.0 20.54% +6.47% bench-compose [.] lex 17.28% +5.55% libc-2.33.so [.] __strcmp_avx2 12.78% +4.01% bench-compose [.] xkb_keysym_from_name 2.30% +0.83% libc-2.33.so [.] __GI_____strtoull_l_internal 3.36% +0.78% bench-compose [.] strcmp@plt Thanks to some careful packing, the memory usage is pretty much the same. Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions