[libcxx-commits] [libcxx] 9a74abc - [libc++] Fix bugs in geomean calculation

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 17 14:22:20 PDT 2025


Author: Louis Dionne
Date: 2025-10-17T17:22:03-04:00
New Revision: 9a74abcd5126f79f0287e471e666bd13782fe139

URL: https://github.com/llvm/llvm-project/commit/9a74abcd5126f79f0287e471e666bd13782fe139
DIFF: https://github.com/llvm/llvm-project/commit/9a74abcd5126f79f0287e471e666bd13782fe139.diff

LOG: [libc++] Fix bugs in geomean calculation

Added: 
    

Modified: 
    libcxx/utils/compare-benchmarks

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/compare-benchmarks b/libcxx/utils/compare-benchmarks
index 88b03dcb97c3d..d165c739183d4 100755
--- a/libcxx/utils/compare-benchmarks
+++ b/libcxx/utils/compare-benchmarks
@@ -69,10 +69,10 @@ def plain_text_comparison(data, metric, baseline_name=None, candidate_name=None)
     table = data[['benchmark', f'{metric}_0', f'{metric}_1', '
diff erence', 'percent']]
 
     # Compute the geomean and report on their 
diff erence
-    geomean_0 = statistics.geometric_mean(data[f'{metric}_0'])
-    geomean_1 = statistics.geometric_mean(data[f'{metric}_1'])
+    geomean_0 = statistics.geometric_mean(data[f'{metric}_0'].dropna())
+    geomean_1 = statistics.geometric_mean(data[f'{metric}_1'].dropna())
     geomean_row = ['Geomean', geomean_0, geomean_1, (geomean_1 - geomean_0), (geomean_1 - geomean_0) / geomean_0]
-    table.loc[len(table)] = geomean_row
+    table.loc[table.index.max()] = geomean_row
 
     return tabulate.tabulate(table.set_index('benchmark'), headers=headers, floatfmt=fmt, numalign='right')
 


        


More information about the libcxx-commits mailing list