faster random number engine
Ulrich Drepper
drepper@gmail.com
Wed Aug 29 15:19:00 GMT 2012
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 default.cc test is expected to fail.
I hope this is an uncontroversial change.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: d-random-sfmt
Type: application/octet-stream
Size: 45012 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20120829/3019492d/attachment.obj>
More information about the Libstdc++
mailing list