lbrycrd/src/bench
Gregory Maxwell 63ff57db4b Avoid integer division in the benchmark inner-most loop.
Previously the benchmark code used an integer division (%) with
 a non-constant in the inner-loop.  This is quite slow on many
 processors, especially ones like ARM that lack a hardware divide.

Even on fairly recent x86_64 like haswell an integer division can
 take something like 100 cycles-- making it comparable to the
 runtime of siphash.

This change avoids the division by using bitmasking instead. This
 was especially easy since the count was only increased by doubling.

This change also restarts the timing when the execution time was
 very low this avoids mintimes of zero in cases where one execution
 ends up below the timer resolution. It also reduces the impact of
 the overhead on the final result.

The formatting of the prints is changed to not use scientific
 notation make it more machine readable (in particular, gnuplot
 croaks on the non-fixedpoint, and it doesn't sort correctly).

This also hoists out all the floating point divisions out of the
 semi-hot path because it was easy to do so.

It might be prudent to break out the critical test into a macro
 just to guarantee that it gets inlined.  It might also make sense
 to just save out the intermediate counts and times and get the
 floating point completely out of the timing loop (because e.g.
 on hardware without a fast hardware FPU like some ARM it will
 still be slow enough to distort the results). I haven't done
 either of these in this commit.
2016-05-30 22:07:56 +00:00
..
.gitignore Ignore bench_bitcoin binary. 2015-10-06 17:46:12 +02:00
bench.cpp Avoid integer division in the benchmark inner-most loop. 2016-05-30 22:07:56 +00:00
bench.h Avoid integer division in the benchmark inner-most loop. 2016-05-30 22:07:56 +00:00
bench_bitcoin.cpp Simple benchmarking framework 2015-09-30 09:24:42 -04:00
crypto_hash.cpp bench: Add crypto hash benchmarks 2016-05-11 19:47:25 +02:00
Examples.cpp Support very-fast-running benchmarks 2015-09-30 09:24:42 -04:00
rollingbloom.cpp Benchmark rolling bloom filter 2016-04-28 14:56:32 +02:00