mirror of
https://github.com/google/benchmark.git
synced 2024-11-29 18:34:47 +00:00
886585a3b7
* Tools: compare-bench.py: print change% with two decimal digits Here is a comparison of before vs. after: ```diff -Benchmark Time CPU Time Old Time New CPU Old CPU New ---------------------------------------------------------------------------------------------------------- -BM_SameTimes +0.00 +0.00 10 10 10 10 -BM_2xFaster -0.50 -0.50 50 25 50 25 -BM_2xSlower +1.00 +1.00 50 100 50 100 -BM_1PercentFaster -0.01 -0.01 100 99 100 99 -BM_1PercentSlower +0.01 +0.01 100 101 100 101 -BM_10PercentFaster -0.10 -0.10 100 90 100 90 -BM_10PercentSlower +0.10 +0.10 100 110 100 110 -BM_100xSlower +99.00 +99.00 100 10000 100 10000 -BM_100xFaster -0.99 -0.99 10000 100 10000 100 -BM_10PercentCPUToTime +0.10 -0.10 100 110 100 90 +Benchmark Time CPU Time Old Time New CPU Old CPU New +------------------------------------------------------------------------------------------------------------- +BM_SameTimes +0.0000 +0.0000 10 10 10 10 +BM_2xFaster -0.5000 -0.5000 50 25 50 25 +BM_2xSlower +1.0000 +1.0000 50 100 50 100 +BM_1PercentFaster -0.0100 -0.0100 100 99 100 99 +BM_1PercentSlower +0.0100 +0.0100 100 101 100 101 +BM_10PercentFaster -0.1000 -0.1000 100 90 100 90 +BM_10PercentSlower +0.1000 +0.1000 100 110 100 110 +BM_100xSlower +99.0000 +99.0000 100 10000 100 10000 +BM_100xFaster -0.9900 -0.9900 10000 100 10000 100 +BM_10PercentCPUToTime +0.1000 -0.1000 100 110 100 90 +BM_ThirdFaster -0.3333 -0.3333 100 67 100 67 ``` So the first ("Time") column is exactly where it was, but with two more decimal digits. The position of the '.' in the second ("CPU") column is shifted right by those two positions, and the rest is unmodified, but simply shifted right by those 4 positions. As for the reasoning, i guess it is more or less the same as with #426. In some sad times, microbenchmarking is not applicable. In those cases, the more precise the change report is, the better. The current formatting prints not so much the percentages, but the fraction i'd say. It is more useful for huge changes, much more than 100%. That is not always the case, especially if it is not a microbenchmark. Then, even though the change may be good/bad, the change is small (<0.5% or so), rounding happens, and it is no longer possible to tell. I do acknowledge that this change does not fix that problem. Of course, confidence intervals and such would be better, and they would probably fix the problem. But i think this is good as-is too, because now the you see 2 fractional percentage digits!1 The obvious downside is that the output is now even wider. * Revisit tests, more closely documents the current behavior.
103 lines
2 KiB
JSON
103 lines
2 KiB
JSON
{
|
|
"context": {
|
|
"date": "2016-08-02 17:44:46",
|
|
"num_cpus": 4,
|
|
"mhz_per_cpu": 4228,
|
|
"cpu_scaling_enabled": false,
|
|
"library_build_type": "release"
|
|
},
|
|
"benchmarks": [
|
|
{
|
|
"name": "BM_SameTimes",
|
|
"iterations": 1000,
|
|
"real_time": 10,
|
|
"cpu_time": 10,
|
|
"time_unit": "ns"
|
|
},
|
|
{
|
|
"name": "BM_2xFaster",
|
|
"iterations": 1000,
|
|
"real_time": 50,
|
|
"cpu_time": 50,
|
|
"time_unit": "ns"
|
|
},
|
|
{
|
|
"name": "BM_2xSlower",
|
|
"iterations": 1000,
|
|
"real_time": 50,
|
|
"cpu_time": 50,
|
|
"time_unit": "ns"
|
|
},
|
|
{
|
|
"name": "BM_1PercentFaster",
|
|
"iterations": 1000,
|
|
"real_time": 100,
|
|
"cpu_time": 100,
|
|
"time_unit": "ns"
|
|
},
|
|
{
|
|
"name": "BM_1PercentSlower",
|
|
"iterations": 1000,
|
|
"real_time": 100,
|
|
"cpu_time": 100,
|
|
"time_unit": "ns"
|
|
},
|
|
{
|
|
"name": "BM_10PercentFaster",
|
|
"iterations": 1000,
|
|
"real_time": 100,
|
|
"cpu_time": 100,
|
|
"time_unit": "ns"
|
|
},
|
|
{
|
|
"name": "BM_10PercentSlower",
|
|
"iterations": 1000,
|
|
"real_time": 100,
|
|
"cpu_time": 100,
|
|
"time_unit": "ns"
|
|
},
|
|
{
|
|
"name": "BM_100xSlower",
|
|
"iterations": 1000,
|
|
"real_time": 100,
|
|
"cpu_time": 100,
|
|
"time_unit": "ns"
|
|
},
|
|
{
|
|
"name": "BM_100xFaster",
|
|
"iterations": 1000,
|
|
"real_time": 10000,
|
|
"cpu_time": 10000,
|
|
"time_unit": "ns"
|
|
},
|
|
{
|
|
"name": "BM_10PercentCPUToTime",
|
|
"iterations": 1000,
|
|
"real_time": 100,
|
|
"cpu_time": 100,
|
|
"time_unit": "ns"
|
|
},
|
|
{
|
|
"name": "BM_ThirdFaster",
|
|
"iterations": 1000,
|
|
"real_time": 100,
|
|
"cpu_time": 100,
|
|
"time_unit": "ns"
|
|
},
|
|
{
|
|
"name": "BM_BadTimeUnit",
|
|
"iterations": 1000,
|
|
"real_time": 0.4,
|
|
"cpu_time": 0.5,
|
|
"time_unit": "s"
|
|
},
|
|
{
|
|
"name": "BM_DifferentTimeUnit",
|
|
"iterations": 1,
|
|
"real_time": 1,
|
|
"cpu_time": 1,
|
|
"time_unit": "s"
|
|
}
|
|
]
|
|
}
|