public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dave Korn <dave.korn.cygwin@googlemail.com>
To: Robert Dewar <dewar@adacore.com>
Cc: Jae Hyuk Kwak <wrice127@gmail.com>, gcc@gnu.org
Subject: Re: Hash Function for "switch statement"
Date: Fri, 19 Mar 2010 22:43:00 -0000	[thread overview]
Message-ID: <4BA3FF48.5070703@gmail.com> (raw)
In-Reply-To: <4BA3F5AD.8070600@adacore.com>

On 19/03/2010 22:07, Robert Dewar wrote:

> You miss my point, doing a mod with 256 is an AWFUL hash algorithm
> since it only uses the low order 8 bits! 

  This statement is only true contingent on a number of significant
assumptions you haven't stated - assumptions which can easily be violated.

> I think you will find that people on this mailing list know all about
> hash tables 

  I think you should get down from that high horse before you come down with
an embarrassing bump.

> So this does not get around the possibility of a bad luck worst case.

  Perfect hashing does exactly that.  That's why it's "popular for hashing
keywords for compilers", and indeed why it "ought to be popular for optimizing
switch statements":

http://burtleburtle.net/bob/hash/perfect.html

    cheers,
      DaveK

  reply	other threads:[~2010-03-19 22:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-14 20:48 Jae Hyuk Kwak
2010-03-15  3:12 ` Basile Starynkevitch
2010-03-15  8:00   ` Jae Hyuk Kwak
2010-03-16  1:41     ` Jae Hyuk Kwak
2010-03-16  7:12       ` Basile Starynkevitch
2010-03-16  6:00     ` Dave Korn
     [not found] ` <20100317200410.GA13807@hungry-tiger.westford.ibm.com>
2010-03-18  6:39   ` Jae Hyuk Kwak
2010-03-18 11:20     ` Andrew Haley
     [not found]     ` <20100318151753.GA4065@hungry-tiger.westford.ibm.com>
2010-03-19  5:26       ` Jae Hyuk Kwak
2010-03-19 12:26         ` Frank Ch. Eigler
2010-03-19 18:11         ` Jae Hyuk Kwak
     [not found]         ` <20100319165443.GA9993@hungry-tiger.westford.ibm.com>
2010-03-19 21:26           ` Jae Hyuk Kwak
2010-03-19 21:30             ` Robert Dewar
2010-03-19 21:53               ` Jae Hyuk Kwak
2010-03-19 22:18                 ` Robert Dewar
2010-03-19 22:43                   ` Dave Korn [this message]
2010-03-19 23:28                     ` Robert Dewar
2010-03-19 22:57                   ` Jae Hyuk Kwak
2010-03-19 23:33                     ` Robert Dewar
2010-03-19 23:33                     ` Robert Dewar
2010-03-19 22:24               ` Dave Korn
2010-03-19 23:09                 ` Robert Dewar
2010-03-19 23:17                   ` Robert Dewar
2010-03-19 19:14     ` Andrew Haley
2010-03-22 12:44 Unruh, Erwin
2010-03-22 13:22 ` Robert Dewar
2010-03-22 16:29   ` Andrew Haley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BA3FF48.5070703@gmail.com \
    --to=dave.korn.cygwin@googlemail.com \
    --cc=dewar@adacore.com \
    --cc=gcc@gnu.org \
    --cc=wrice127@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).