At 07:36 PM 1/18/00 -0500, Bruce Momjian wrote:
>[Charset ISO-8859-1 unsupported, filtering to ASCII...]
>> A while ago I played around with gperf (GNU perfect hash function
>> generator), abusing the keyword lookup in parser/keyword.c as playground.
>> Now before I delete this I was wondering if this would perhaps be of use
>> to the general public. I don't know how huge the speed advantage of this
>> is, I'm sure the parser/scanner speed is the least of our problems. But I
>> thunk especially ecpg could benefit from this. Btw., gperf is used by GCC,
>> so it's not a toy.
>
>keywords are a fixed array, with a binary search to find a match. Could
>gperf be faster? We also can not distribute GNU code.
I wondered about this last, i.e. the use of GNU code since Postgres
is licensed differently.
The reality is that looking up keywords form a tiny fraction of the
time spent by any language system I can think of. The current binary
search on a fixed array might be faster, might be slower than a perfect
hash on a particular machine depending on the calculation done to
do the hashing.
Whether faster or slower, though, I can't imagine either method taking
noticably more than 0% of the total time to process a query, even the
most simple queries.
- Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert
Serviceand other goodies at http://donb.photo.net.