
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/02/2010 12:37 PM, Scott McMurray wrote:
I've been assuming that the copy-on-write was responsible for the major part of the speed difference, but after thinking about it, that doesn't make a lot of sense. The serialized access to the random number generator could be responsible for a good part of it. The tests I based that assumption on used it heavily. I'll run some further tests when I have a chance today to see how they turn out.
Why do you have a global random number generator at all?
Because I hadn't thought about an alternative until you said this. :-)
Boost.Random doesn't provide one, so I don't see why you should either.
It *would* simplify things greatly for me. I'm just concerned that it might make things more difficult for someone who just wants to use the library for a quick one-off test. My goal is, as much as possible, to stay out of the way of the person using the library -- for that, having a default "good enough" random generator is pretty much a necessity. (The use-case I'm basing that on: When I'm trying to solve a problem, and go hunting for a tool that I need to do it, it's frustrating to have to spend a lot of time learning how to set up the tool -- I just want something that I can quickly use to solve the problem at hand. Later, when I'm not so focused on a specific problem, I'll gladly dig into the documentation and figure out the non-default features that I might find a future use for.) Maybe if I had a random number generator as a parameter, defaulting to an internal global one that is deliberately *not* thread-safe, and simply documented that if you use it from multiple threads, you're responsible for either serializing the access or providing your own generators...? - -- Chad Nelson Oak Circle Software, Inc. * * * -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkvdtMsACgkQp9x9jeZ9/wSR0gCeNZ1DAFzFnmz9SPT7dmvgw3/Y /cIAoMmZQFMWfxLTQBQSW9Okerxsdz7f =qEQ6 -----END PGP SIGNATURE-----