[PATCH libxkbcommon 1/2] makekeys: replace helper with python script and binary search
ran234 at gmail.com
Wed Oct 17 11:26:07 PDT 2012
On Tue, Oct 16, 2012 at 10:08:30PM +0200, David Herrmann wrote:
> Hi Ran
> On Tue, Oct 16, 2012 at 9:58 PM, Ran Benita <ran234 at gmail.com> wrote:
> > On Tue, Oct 16, 2012 at 04:05:33PM +0200, David Herrmann wrote:
> >> From: Ran Benita <ran234 at gmail.com>
> >> This removes the complicated and undocumented hash-table creation-helper
> >> and replaces it with an autogenerated sorted array. The search uses simple
> >> bsearch() now.
> >> We also tried using gperf but it turned out to generate way to big
> >> hashtables and when reducing the size it isn't really faster than
> >> bsearch() anymore.
> >> There are no users complaining about the speed of keysym lookups and we
> >> have no benchmarks that tell that we are horribly slow. Hence, we can
> >> safely use the simpler approach and drop all that old code.
> > I took the patches to my tree, with a couple of small non-functional
> > changes. It should appear in master in some time, unless Daniel has a
> > problem with breaking this particular API now. Though for me it seems
> > like a good time to drop all of our compat shims before releasing, as
> > the toolkits need to be updated for Wayland anyway.
> > This turned out nicely, thanks again.
> > Ran
> "...and test a couple 'thorny' cases..."
> haha, hilarious :)
Heh, I was just curious when reading find_syms() and ran this:
grep '^#define XKB_' xkbcommon/xkbcommon-keysyms.h | column -t | \
cut -d' ' -f3 | tr 'A-Z' 'a-z' | sort | uniq -c | sort -rn | head
Thought it might be nice to add it as a test.
> Thanks for picking it up. Daniel already mentioned that he is ok with
> the API-break so I think he will pull it right away from your tree.
FYI, I've added another commit which just adds the ks_tables.h file
to git, same as we do with xkbcommon-keysyms.h (and they're now
generated together with 'make update-keysyms'). It removes the python
build-dep and makes more sense, I think; the casual builder doesn't
need to touch the makekeys thing at all.
More information about the wayland-devel