[Haskell-cafe] Switch optimization

2007-06-10 Thread Thomas Conway
Hi All, I'm writing some variable byte codec routines, which are used in inner^N loops, and which I want to make really efficient. There are several spots where the code uses lookup tables. The best example is the table, which given the first byte, returns the number of additional bytes. It is

Re: [Haskell-cafe] Switch optimization

2007-06-10 Thread Stefan O'Rear
On Mon, Jun 11, 2007 at 09:43:17AM +1000, Thomas Conway wrote: Hi All, I'm writing some variable byte codec routines, which are used in inner^N loops, and which I want to make really efficient. There are several spots where the code uses lookup tables. The best example is the table, which

[Haskell-cafe] Switch optimization

2007-06-10 Thread Tom Pledger
Stefan O'Rear wrote: | On Mon, Jun 11, 2007 at 09:43:17AM +1000, Thomas Conway wrote: : | codeLen 127 = 0 | codeLen 128 = 1 | ... | codeLen 255 = 8 | | Now, compiling with ghc 6.6.1 and -O3, I see that it generates a long | chain of conditional branches. : That's deeply tied in