Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-06-01 14:24:40

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. :-)

Boost list run by bdawes at, gregod at, cpdaniel at, john at