On Wednesday, 24 July 2013 at 07:20:16 UTC, Peter Alexander wrote:
This comment is worrying:
"Can you try D version without std.random, and use srand and
rand from std.c.stdlib? I think it should be almost same speed
as C version ;-)"
"Wow! Just tried that, and this brings the running time of the
DMD-compiled version to 0.770s from 1.290, the GDC-compiled
version from 1.060 to 0.680s, and the LDC version to 0.580s
from 0.710s. Meaning the LDC version is on par with the
Clang-compiled C version and just slightly beats the
GCC-compiled C one! There really should be a warning note in
the std.random library documentation that for
performance-critical code the C stdlib random generator is a
better choice."
Is this just because RNGs are value types? It's literally
causing bad press for D, so this needs to be high on the
priority list.
The whole of std.random is nothing but problems and pitfalls,
biting us and our users on a regular basis :/
Designing a new "std.random2" or "std.rand" should be high on our
todo list. That, and I think "std.random" should go the way of
"std.xml": A big fat warning telling users it is doomed for
replacement, and, perhaps, a brief explanation of the problems,
and their potential workarounds.