From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Walker To: Zack Weinberg Cc: GCC general mailing list Subject: Re: Hashing of "switch/case" selections Date: Sun, 07 Jan 2001 18:12:00 -0000 Message-id: <3A5922B5.B099557A@stl.quik.com> References: <3A4AC4FC.35E70BEE@stl.quik.com> <20010104013910.F12948@wolery.stanford.edu> X-SW-Source: 2001-01/msg00338.html Ok. I will. Andy Zack Weinberg wrote: > On Wed, Dec 27, 2000 at 10:43:40PM -0600, Andy Walker wrote: > [much interesting stuff] > > My experience as a programmer is that programs are almost never written > > with switches to more than a few hundred cases. I personally have never > > seen one. More than that, and the programmer finds a more efficient, > > more readable, more maintainable solution, and he can do so because he > > has a deep knowledge of the problem that is unavailable to the > > compiler. My seat-of-pants estimate is that 400 cases is a good, maybe > > even high, maximum for Hash evaluations. A program containing a switch > > statement with more than 400 cases in it probably has enough other > > severe design problems that it will never be worth running anyway. > > This is true in my experience for code written by humans, but not > necessarily for machine-generated code. Take a look at insn-attrtab.c > in your GCC build directory, or at cp/parse.c in the source tree. > > zw