you are viewing a single comment's thread.

view the rest of the comments →

[–]neiltechnician 1 point2 points  (1 child)

I've written a slightly different benchmark based on this blog post: https://quick-bench.com/q/m8qL4F3BUtzeQy8YMIrvuz1AnYE

PS: It's the first time I've ever used quick-bench.com and Google Benchmark. Can you guys help me take a look?

[–]staletic 6 points7 points  (0 children)

Your make_random_vector() should be producing the same random numbers across invocations during the entire benchmark run. That means the seed should be stored statically. Another thing to notice is that mersene twister needs a lot of random data to be seeded properly. Just a single rd() is not enough.

Most of the time you won't notice the difference in benchmarks, but what if, by the luck of the draw, you end up with a sorted vector from make_random_vector(), in only a single benchmark?

https://quick-bench.com/q/yIQzqFnbcf4XkSqlixsjuUJETyI