[Haskell-cafe] Understanding allocation behavior

David F. Place d at vidplace.com
Sun Apr 9 09:47:03 EDT 2006


Hi Bulat,

On Apr 9, 2006, at 6:31 AM, Bulat Ziganshin wrote:

> on the other side, these procedures can use the same divide-to-bytes
> technique as `size`
>
> findMinIndex 0 = undefined
> findMinIndex n = case (n `shiftR` 8) of
>                    0 -> minIndexInByte ! (n .&. 255)
>                    b -> 8 + findMinIndex b
>
> something like this should work


In an email to me, Jean-Philippe Bernardy expressed a concern that a  
large table could needlessly fill the data cache.  He proposed  
checking 4 bits at a time and using a small table of 16 elements.   
Not surprisingly, it isn't as fast.  I wonder what you think of  
this.  Also, I wonder what would be a good test to demonstrate this  
possible interaction with the cache.

Cheers, David

ps.  Thanks for the tip about UArray.

--------------------------------
David F. Place
mailto:d at vidplace.com



More information about the Haskell-Cafe mailing list