[Haskell-cafe] Performance help

Ryan Ingram ryani.spam at gmail.com
Tue Nov 13 17:21:40 EST 2007


On 11/13/07, Ryan Ingram <ryani.spam at gmail.com> wrote:
>
> Also, what stops getRule from going off the end of the array?  I didn't
> see anything that prevented that in the code, and you're using unsafeAt,
> which seems like a potential bug.
>

Never mind, I realized this is a ring buffer with `mod` s.   That's another
slow operation when you're doing code as tight as this.  If you can
guarantee the ring is a power of 2 in size you can use a mask instead, or
use my original suggestion of deriving rules from the previous rule and the
new bit; the initial state is determined by the last bits in the buffer and
you never wrap.

  -- ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071113/a4916827/attachment.htm


More information about the Haskell-Cafe mailing list