bug-gperf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gperf] Library


From: Bruno Haible
Subject: Re: [bug-gperf] Library
Date: Fri, 7 Aug 2009 22:24:40 +0200
User-agent: KMail/1.9.9

Hi,

Gustavo Rondina wrote:
> Is it possible to use gperf as a library? Does such facility exist? I want
> to generate a perfect hash function in a code of mine where all the entries
> of the table will be known at some certain point, prior their uses. At that
> point I would like to generate the perfect hash function, but it seems gperf
> only works from the command line. I suppose I could writte some wrappers and
> scripts to print the entries from my code, manage them and then call gperf
> to generate the relevant hashing code, and afterwards compile the generated
> code and link itto my existing code and proceed with the execution, but this
> sounds cumbersome at best.

gperf spends an *awful* lot of CPU cycles in order to find a "perfect" hash
table. This effort is only outweighed if later the resulting code is used
millions and billions of times.

For use in a single process, where the number of accesses of a fixed hash table
content rarely exceeds 10000, even less 1000000, you are making a better trade-
off by using plain hash tables with some collision resolution mechanism and
filling these hash tables at run-time. There are dozens of implementations of
hash tables for C or C++.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]