From: Reini U. <ru...@x-...> - 2006-05-02 07:34:49
|
2006/5/1, Robert May <rm...@po...>: > I have looked into 3 alternative hashing strategies, all implemented in > XS (as an aside, the overhead of calling an XS function that does > nothing compares very favourably with a perl hash lookup, and so > previous concerns that I had about XS calls being slow seem unfounded): > > Strategy 1: non-order preserving minimal perfect hash, based on the > algorithm and C source from > http://burtleburtle.net/bob/hash/perfect.html I will call this the > 'Perfect' algorithm > > Strategy 2: non-order preserving (non-minimal) perfect hash, generated > using gperf: http://gnuwin32.sourceforge.net/packages/gperf.htm I will > call this the 'Gperf' algorithm. > > Strategy 3: Order-preserving minimal perfect hash. based on the code > from: http://www.ibiblio.org/pub/Linux/devel/lang/c/mph-1.2.tar.gz I > will call this the 'MPH' algorithm > > The original ladder-of-if's found in GUI_constants.cpp will be called > the 'Win32::GUI' algorithm > > The current hash implementation discussed here for Win32::GUI::Constants > will be called the 'Hash' algorithm. Good to see that finally gperf found its successors: Perfect and MPH. gperf is completely insatisfactory not finding a solution, esp. when you know that it comes from a common lisp programmer. http://burtleburtle.net/bob/hash/perfect.html looks fine. Go for it. But don't forget to support EXPORT tag groups and wildcards. use Win32::GUI::Constants qw(!/^T/); #don't export T* constants -- Reini |