
"Peter Dimov" <pdimov@mmltd.net> wrote in news:00d501c7a47a$32806870$6407a80a@pdimov2:
Dave Jenkins wrote:
Andy, You did a nice job speeding up the uuid::create(engine) function to 0.4 seconds for 1 million UUIDs. But now the uuid::create() function is extremely slow - 131 seconds for 1 million UUIDs (source code below).
The requirement for uuid::create to be fast conflicts with the requirement that it needs to create a "universally unique identifier", that is, a high-quality random number. Typically, high-quality randomness is more important than performance, as one rarely needs to create one million UUIDs. One could argue that the high-performance case is adequately addressed by the engine-taking overload.
Can you change it to use a static mt19937 engine?
This introduces thread safety issues.
All that said, the current uuid::create throws away most of the randomness produced by the random digest helper function and uses only 32 bits of it as a seed, so it's not really high quality. :-)
I will look into using all of the randomness produced by the random digest helper function. I did look at the function mersenne_twister::seed(It& first, It last), but couldn't get it to work. I take another shot at it. Thanks, Andy.