NIFnized version of SFMT PRNG (Re: [erlang-questions] native Erlang version of SFMT PRNG)

Kenji Rikitake kenji.rikitake@REDACTED
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.
It's on
http://github.com/jj1bdx/sfmt-erlang/tree/0.3.0_RELEASE/
(and it's on the "master" branch of
http://github.com/jj1bdx/sfmt-erlang/
)

I'm new to NIF (and Erlang/OTP memory/code-loading management), and your
comments are always welcome.

Regards,
Kenji Rikitake

In the message <20100704073201.GA37621@REDACTED>
dated Sun, Jul 04, 2010 at 04:31:37PM +0900,
Kenji Rikitake <kenji.rikitake@REDACTED> writes:
> A crude pure Erlang version of SFMT
> (SIMD-oriented Fast Mersenne Twister) PRNG:
> http://github.com/jj1bdx/sfmt-erlang
> 
> 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:
> http://github.com/jj1bdx/sfmt-extstate
> 
> Kenji Rikitake
> (well, if nobody does something for me, I have to do it anyway :))
> 
> In the message <20100530075320.GA29981@REDACTED>
> dated Sun, May 30, 2010 at 04:52:56PM +0900,
> Kenji Rikitake <kenji.rikitake@REDACTED> 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 mailing list