[Haskell-cafe] Counting bits: Sanity Check

David F. Place d at vidplace.com
Wed Apr 12 16:55:05 EDT 2006

On Apr 12, 2006, at 3:30 PM, Daniel McAllansmith wrote:

> Averages of user time for three runs on an Athlon64 running 64bit  
> linux:
> kern	0.29700
> ones32 	0.30733
> table32	0.37333
> table 	0.38400
> I ran a whole lot more of kern and ones32... kern was consistently  
> faster than
> ones32.  Curious.

Yes, especially curious since the algorithm is taken from AMD's  
optimization guide for the Athlon and Opteron series.  I'm not good  
enough at reading core syntax to be able to see what GHC is doing  
with it.

I wonder how this other crazy algorithm I found will work on your 64  
bit omputer.   It is much slower on my 32 bit PPC powerbook for  
obvious reasons.   If you'd like to try it, I'll include an updated  
BitTwiddle.hs .

time ./bits 2000000 3000000 64

-------------- next part --------------
A non-text attachment was scrubbed...
Name: BitTwiddle.hs
Type: application/octet-stream
Size: 3731 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20060412/3b2bda99/BitTwiddle.obj
-------------- next part --------------

David F. Place
mailto:d at vidplace.com

More information about the Haskell-Cafe mailing list