This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

faster random number engine

The <random> header so far contains the random number engines
documented in the header.  None of these are well suited for modern
CPUs.  There is a variant of the Mersenne twister engines which is
explicitly designed to perform well on CPUs with SIMD instructions.
The result is an engine with equal properties to the original Mersenne
twisters but several times faster.

The attached patch implements this new engine.  It's in the __gnu_cxx
namespace.  I added definitions for all the variants defined by the
authors.  The test suite checks the returned values based on results
obtained from the original code.  The SIMD optimization is so far done
for x86.  In all other cases a generic implementation is used.  The
generic implementation works correctly for little endian machines.
For big endian machines someone will come up with fixes.  Until then
the new test is expected to fail.

I hope this is an uncontroversial change.

Attachment: d-random-sfmt
Description: Binary data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]