diff options
author | Damian Gryski <[email protected]> | 2023-05-16 13:44:48 -0700 |
---|---|---|
committer | Ron Evans <[email protected]> | 2023-06-06 09:30:35 +0200 |
commit | ee5890f36f894fea8d4a918170b66ea4fff4ee7d (patch) | |
tree | b248c5f47ff320afe839b1487ff3e1b3615d3eb5 /tools | |
parent | 744574193b9e213bc2d897d5e5f02ec1c256ff7a (diff) | |
download | tinygo-ee5890f36f894fea8d4a918170b66ea4fff4ee7d.tar.gz tinygo-ee5890f36f894fea8d4a918170b66ea4fff4ee7d.zip |
tools: use geomean for sizediff
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/sizediff | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/sizediff b/tools/sizediff index 84cdea449..9c5dc705c 100755 --- a/tools/sizediff +++ b/tools/sizediff @@ -70,13 +70,17 @@ def main(): totalCode0 = 0 totalCode1 = 0 totalDiff = 0 + totalProduct = 1 print(' before after diff') for comparison in comparisons: - print('%7d %7d %6d %6.2f%% %s' % (comparison.flash0, comparison.flash1, comparison.flashdiff, comparison.flashdiff / comparison.flash0 * 100, comparison.command)) + diffPct = comparison.flashdiff / comparison.flash0 + print('%7d %7d %6d %6.2f%% %s' % (comparison.flash0, comparison.flash1, comparison.flashdiff, diffPct * 100, comparison.command)) totalCode0 += comparison.flash0 totalCode1 += comparison.flash1 totalDiff += comparison.flashdiff - print('%7d %7d %6d %6.2f%% sum' % (totalCode0, totalCode1, totalDiff, totalDiff / totalCode0 * 100)) + totalProduct *= (1 + diffPct) + geomean = totalProduct ** (1.0 / float(len(comparisons))) + print('%7d %7d %6d %6.2f%% sum' % (totalCode0, totalCode1, totalDiff, geomean - 1)) if __name__ == '__main__': |