NIFnized version of SFMT PRNG (Re: [erlang-questions] native Erlang version of SFMT PRNG)
Sun Jul 11 10:06:02 CEST 2010
On SFMT PRNG library for Erlang/OTP:
Now I included sfmt-extstate code as a NIF library
and it's working on Erlang/OTP R14A on FreeBSD.
It's ~40 times faster than the pure Erlang code
and now ~17 times faster than the random module code.
(and it's on the "master" branch of
I'm new to NIF (and Erlang/OTP memory/code-loading management), and your
comments are always welcome.
In the message <>
dated Sun, Jul 04, 2010 at 04:31:37PM +0900,
Kenji Rikitake <> writes:
> A crude pure Erlang version of SFMT
> (SIMD-oriented Fast Mersenne Twister) PRNG:
> Note: this code is still ~300 times slower than the C code of SFMT
> even when HiPE enabled on Erlang/OTP R14A at FreeBSD 7.3-RELEASE x86;
> a NIF set will boost the speed. I've already dissected the original
> SFMT code for a thread-safe implementation at:
> Kenji Rikitake
> (well, if nobody does something for me, I have to do it anyway :))
> In the message <>
> dated Sun, May 30, 2010 at 04:52:56PM +0900,
> Kenji Rikitake <> writes:
> > Anybody has implemented a NIF or port version of Mersenne Twister or SFMT?
> > http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html
> > (Mersenne Twister has been incorporated as the default RNG for Python
> > and R, so far as I know.)
More information about the erlang-questions