Repository navigation
Set repetitions of benchmark to 10. - #4053
Conversation
This allows us to get more sample points in one run, and can get more stable results.
|
|
||
| TS="$(date +%s)000" | ||
| SED_EXPR='s/BM_[[:alnum:][:punct:]]+ [[:space:]]+ ([0-9]+) ms[[:print:]]+/\1/p' | ||
| SED_EXPR='s/BM_[[:alnum:][:punct:]]+\/real_time[[:space:]]+ ([.0-9]+) ms[[:print:]]+/\1/p' |
There was a problem hiding this comment.
This is fine for now, but note that Benchmark has structured output as well, which is probably what we should be using (https://github.com/google/benchmark#output-formats)
There was a problem hiding this comment.
Got you, I just feel this is easy enough, instead of parsing a json file in bash. CSV format is probably good.
| for ms in "$(sed -En -e "${SED_EXPR}" "${test_out}")"; do | ||
| "--driver=${driver}" \ | ||
| --benchmark_repetitions=10 \ | ||
| --benchmark_min_time=1 | tee "${test_out}" |
There was a problem hiding this comment.
Nit relative to the description. This isn't warmup time, it's the sampling time
There was a problem hiding this comment.
I thought benchmark_min_time is to set the running time before real benchmarks? I tried with fullyconnect test, and the total execution time is longer, but the report time is still less than 1 sec, like 0.107 ms. So I thought this is kind of warmup time.
There was a problem hiding this comment.
No benchmark is already averaging over many many runs for the report time. You should see a number of iterations as part of the report. The way it works is approximately like this. For each benchmark:
- Run the benchmark a few times to see how long it takes. This also serves as a warmup.
- Based on how long the benchmark took during these runs, calculate how many times to run it such that it runs at least once, not more than 1e9 times, and for at least
benchmark_min_time. (I think there is also some observation of the variance on the initial runs the informs the decision here). - Run it that many times.
- Report the average for those iterations as well as the number of iterations.
- If
benchmark_repetitionsis set, repeat for that many repetitions (I think it may not repeat step 1 though) and report statistical aggregations across those repetitions.
Anyway, increasing benchmark_min_time is fine, but unless you have a reason you think we need to increase it, I would just leave it as the default. It does not increase the warmup time, only the sampling time.
There was a problem hiding this comment.
I see, thanks for the detailed explanation! Let's leave it as the default. I'll update the commit message.
This allows us to get more sample points in one run, and can get more
stable results.
Ignore the report of mean/median/stddev because Mako can deal with them.