This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Hash Function for "switch statement"


Jae Hyuk Kwak wrote:

A quote from this article:

" ... the switch very efficiently, even constructing a hash table if this
method of switching is ..."

Yes, it does. Such a old paper mentioned it and we are still not doing it. So it makes me wonder why.

Why? Perhaps because it is not helpful in practice ???


Perfect hashing is even older, first referenced in the early 1950's not sure of exact date, but some time around then.

As I say, I am pretty sure that BCPL did use perfect hashing, but you still have to show that it is helpful in practice. That's really the
only resolution of the game of guessing whether it is worthwhile.


What you need to do is to implement the perfect hashing possibility,
then run the modified compiler over a big chunk of real life code,
and see if you find any significant improvements (or degradation).
You might be able to concoct an artificial example where it helps,
but that's never a convincing way of justifying an optimization
(though it is all too commonly done :-))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]