Re: Hash Function for "switch statement"

2010-03-19 Thread Jae Hyuk Kwak
Thanks for the fast reply, On Fri, Mar 19, 2010 at 3:07 PM, Robert Dewar wrote: >> "In many situations, hash tables turn out to be more efficient than >> search trees or any other table lookup structure." > > The above quote from Wikipedia is indeed misleading because it does > not make a cleare

Re: Hash Function for "switch statement"

2010-03-19 Thread Jae Hyuk Kwak
Hi Robert, On Fri, Mar 19, 2010 at 2:13 PM, Robert Dewar wrote: > Jae Hyuk Kwak wrote: > >> For the issue of Modulus operation, it does not need to be divide or >> hardware modulus operation. >> Let me give you an example here: >> 13 % 2 = 1 >> 13 & (

Re: Hash Function for "switch statement"

2010-03-19 Thread Jae Hyuk Kwak
Hi Michael, Thank you for the detailed response. On Fri, Mar 19, 2010 at 9:54 AM, Michael Meissner wrote: > On Thu, Mar 18, 2010 at 05:10:18PM -0700, Jae Hyuk Kwak wrote: >> Hi Michael, >> >> Thank you for the details. >> If I understood correctly, your point is t

Re: Hash Function for "switch statement"

2010-03-19 Thread Jae Hyuk Kwak
Let me correct my mistake. > If I understood correctly, your point is that O(log N) is fast enough > because the size of switch is small in practice. > But I am still not convinced that using hash table would not increase the > speed. > As we know hash table requires O(N) only. > There must be so

Re: Hash Function for "switch statement"

2010-03-18 Thread Jae Hyuk Kwak
Hi Michael, Thank you for the details. On Thu, Mar 18, 2010 at 8:17 AM, Michael Meissner wrote: >> > Note, that many hash tables are computed by the modulus operation, which is >> > often fairly expensive (and on machines without a hardware divide unit, >> > requiring a function call).  I would

Re: Hash Function for "switch statement"

2010-03-17 Thread Jae Hyuk Kwak
On Wed, Mar 17, 2010 at 1:04 PM, Michael Meissner wrote: > Note, that many hash tables are computed by the modulus operation, which is > often fairly expensive (and on machines without a hardware divide unit, > requiring a function call). I would expect many switch statements would slow > down if

Re: Hash Function for "switch statement"

2010-03-15 Thread Jae Hyuk Kwak
at that point. I'm sorry... Jay On Mon, Mar 15, 2010 at 12:19 AM, Jae Hyuk Kwak wrote: > Thank you Basile. > The article you pointed is exactly what I wanted to find. > The paper summarized switch optimization very well, and it enlightened me. > I am also glad that it mentio

Re: Hash Function for "switch statement"

2010-03-15 Thread Jae Hyuk Kwak
n near future. I haven't heard about "MELT" before and still don't know what exactly it is. Is it able to deal with this kind of problem? Thank you anyway. Without the reply mail, I couldn't be satisfied this much. :-) Regards, Jay On Sun, Mar 14, 2010 at 3:59 PM,

Hash Function for "switch statement"

2010-03-14 Thread Jae Hyuk Kwak
Hello, GCC developers. I'm not sure whether this is a proper mail address to talk about this or not. But I am giving a shot. Last week, I was pondering a way to get Enum values from other unique values like string and integer. My thought reached at an idea of using Hash table as usual.. In a