On Sat, Nov 4, 2017 at 10:59 PM, Peter Dimov via Boost < boost@lists.boost.org> wrote:
James E. King, III wrote:
Benchmark Times reusing a generator (1M loops):
old implementation: 0.021822s wall, 0.031250s user + 0.000000s system = 0.031250s CPU (143.2%) new implementation: 0.373160s wall, 0.375000s user + 0.000000s system = 0.375000s CPU (100.5%)
Benchmark Times using a new generator for each uuid (10K loops): old implementation: 1.168479s wall, 1.171875s user + 0.000000s system = 1.171875s CPU (100.3%) new implementation: 0.010272s wall, 0.015625s user + 0.000000s system = 0.015625s CPU (152.1%)
These results look odd to me. What code exactly is being tested?
I went over it a number of times to be sure, and stepped through with the debugger to make sure it was actually going into the right code paths. I'll have to recreate the test as a separate benchmark that I can submit and build as part of the project. I was using boost::timer::auto_cpu_timer to do the timing. The "old implementation" is the current boost 1.65.1 uuids::random_generator. The "new implementation" would be the header-only random_device from my Boost.Random PR wrapped inside uuids::basic_random_generator, so there would be no seed() method and it would acquire 4 bytes of entropy at a time. That's why I wrote a separate test to acquire 16 bytes of entropy at a time, and that too was slower than reusing mt19937 for the same number of loops to generate uuids. When I have a PR to reference, I'll post it. - Jim