aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorDamian Gryski <[email protected]>2023-05-16 13:44:48 -0700
committerRon Evans <[email protected]>2023-06-06 09:30:35 +0200
commitee5890f36f894fea8d4a918170b66ea4fff4ee7d (patch)
treeb248c5f47ff320afe839b1487ff3e1b3615d3eb5 /tools
parent744574193b9e213bc2d897d5e5f02ec1c256ff7a (diff)
downloadtinygo-ee5890f36f894fea8d4a918170b66ea4fff4ee7d.tar.gz
tinygo-ee5890f36f894fea8d4a918170b66ea4fff4ee7d.zip
tools: use geomean for sizediff
Diffstat (limited to 'tools')
-rwxr-xr-xtools/sizediff8
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__':