Boost logo

Boost :

Subject: Re: [boost] Removing auto_ptr/etc. from Boost
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2015-03-19 11:36:51

On Thursday 19 March 2015 09:28:11 Steven Watanabe wrote:
> On 03/19/2015 03:03 AM, Andrey Semashev wrote:
> > Boost.Log is missing here.
> >
> > I'm worried about random_shuffle. In Boost.Log case I don't care about
> > randomness quality, what's important is performance. I suspect replacing
> > random_shuffle with shuffle+RNG will be inferior,
> I highly doubt it. The algorithm is
> essentially the same, the only difference
> is the source of randomness.

That's the source of my suspicion. Looking at Boost.Random, creating RNG
involves seed generation, which is probably one or several syscalls, let alone
any possible resource allocations. This has to be done on each call to
shuffle, if I understand correctly. Compare that with rand(), which is
presumably purely computational and never fails.

> In fact,
> if you don't care about the randomness,
> with shuffle, it's easier to substitute
> a faster, lower quality PRNG.

That's what rand() is for, isn't it? But as far as I can see, there is no
standard adapter of this function to the RNG interface, so I have to write
one. I can do that, no problem, but this is clearly a case for random_shuffle
to exist for.

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