Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: Good hash for pointers Date: Wed, 05 Jun 2024 21:40:27 -0700 Organization: A noiseless patient Spider Lines: 23 Message-ID: <86y17ilm4k.fsf@linuxsc.com> References: <86fru6gsqr.fsf@linuxsc.com> <8634q5hjsp.fsf@linuxsc.com> <86le3wfsmd.fsf@linuxsc.com> <86ed9ofq14.fsf@linuxsc.com> <20240605005916.00001b33@yahoo.com> <86a5jzmle1.fsf@linuxsc.com> <20240605195905.00002484@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Thu, 06 Jun 2024 06:40:28 +0200 (CEST) Injection-Info: dont-email.me; posting-host="d27732bb70530c4a14d68e0b12f92cb8"; logging-data="1440310"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7+JJbRJiAeNj1G8toGfDbaB4ZWDMGOUA=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:CaXIMenGW8FrmK0rY9TNuDjz9lM= sha1:VS2G+DHm0GeciTiRih7phUUxsOI= Bytes: 2211 Michael S writes: > On Wed, 05 Jun 2024 08:58:46 -0700 > Tim Rentsch wrote: > >> I did get your own hash function out and put it into my little >> test rig. There may be summary comments below. > > > > As you probably already paid attention, I like bottom lines. > What is a bottom line here? The bottom line is both the multiply-by-a-large-prime hashes should be avoided. > Did you you encounter cases in which almost-bonita's-but-not-quite > hash function performed badly? Yes. A clear example is using directly mapped hash table that has a power of two elements, with inputs all from malloc( 48 ) calls. All keys map to one of only 1024 entries, in a hash table that has 65536 slots.