|Is Minimal Perfect Hashing the wrong algorithm? email@example.com (Charles Fiterman) (1996-04-02)|
|Re: Is Minimal Perfect Hashing the wrong algorithm? firstname.lastname@example.org.OZ.AU (1996-04-04)|
|Re: Is Minimal Perfect Hashing the wrong algorithm? email@example.com (1996-04-06)|
|Re: Is Minimal Perfect Hashing the wrong algorithm? firstname.lastname@example.org (Alexander Krotoff) (1996-04-07)|
|Is Minimal Perfect Hashing the wrong algorithm? email@example.com (1996-04-08)|
|Re: Is Minimal Perfect Hashing the wrong algorithm? firstname.lastname@example.org (Dave Lloyd) (1996-04-08)|
|Re: Is Minimal Perfect Hashing the wrong algorithm? email@example.com (1996-04-10)|
|Re: Is Minimal Perfect Hashing the wrong algorithm? firstname.lastname@example.org (Dave Toland) (1996-04-11)|
|From:||Dave Toland <email@example.com>|
|Date:||11 Apr 1996 23:41:01 -0400|
|Organization:||Locus Computing Corp.|
Charles Fiterman <firstname.lastname@example.org> writes:
>Many compiler writers use Minimal Perfect Hashing to generate some
>hash tables such as a key word table.
>But this algorithm minimizes table size. Shouldn't it minimize lookup
>time with a cap on table size?
Preston Briggs wrote:
> I think it's even worse than you suggest. Given some unknown
> alphabetic token, we first look in this minimal table to see if it's a
> keyword. If it isn't, we assume it's an identifier. Since the
> minimal table is dense, every identifier will collide with some
> keyword and we'll have to do a string compare to resolve the question
> of "keyword or id?"
Very true, if you use this probe for every identifier you encounter.
On the other hand it does work very well for assemblers or other
translators where your lexer has enough context knowledge that it
expects/requires a keyword when it is in a particular state.
On the third hand :-), It still doesn't buy you much over an open hash
shared with the dynamic symbols provided your table is sufficiently
large to make keyword collisions unlikely, unless you are unlucky
enough to have collisions on frequently used keywords. But you don't
need perfect hash to tune around that.
Dave Toland email@example.com
Return to the
Search the comp.compilers archives again.