Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: hash function for mac needed
Message-ID: <1991Jun19.161959.13677@zoo.toronto.edu>
Date: Wed, 19 Jun 1991 16:19:59 GMT
References: <14207.285B768A@stjhmc.fidonet.org> <14396@dog.ee.lbl.gov> <567@smds.UUCP>
Organization: U of Toronto Zoology

In article <567@smds.UUCP> rh@smds.UUCP (Richard Harter) writes:
>> ... a fast hash function is
>> better than a slower-but-better-distribution function...
>In one of my programs I found it quite profitable to only look at the last
>ten characters of a string...
>Admittedly this appears crude, but in practice the last ten bytes were
>all that were really needed...

In fact, when I originally did the hashed newsgroup-lookup code in C News
expire, a quick investigation did not reveal any hashing function which
had overall performance much better than simply using the length of the
string!  (The newsgroup list has grown so much that this decision is in
need of revision, mind you.)
-- 
"We're thinking about upgrading from    | Henry Spencer @ U of Toronto Zoology
SunOS 4.1.1 to SunOS 3.5."              |  henry@zoo.toronto.edu  utzoo!henry
