[Haskell-cafe] How to improve speed? (MersenneTwister is several times slower than C version)

Bulat Ziganshin bulat.ziganshin at gmail.com
Thu Nov 2 03:28:38 EST 2006


Hello Lennart,

Thursday, November 2, 2006, 4:34:04 AM, you wrote:

> A big problem with the Mersenne Twister is the shifts.  As has been  
> noted elsewhere, ghc doesn't do such a great job on those.

#ifdef __GLASGOW_HASKELL__

(I# a) <<# (I# b) = (I# (a `iShiftL#` b))
(I# a) >># (I# b) = (I# (a `uncheckedIShiftRL#` b))

#else /* ! __GLASGOW_HASKELL__ */

a <<# b = a `shiftL` b
a >># b = a `shiftR` b

#endif /* ! __GLASGOW_HASKELL__ */



-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list