Skip to content

Commit 9a74abc

Browse files
committed
[libc++] Fix bugs in geomean calculation
1 parent 62f9115 commit 9a74abc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libcxx/utils/compare-benchmarks

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def plain_text_comparison(data, metric, baseline_name=None, candidate_name=None)
6969
table = data[['benchmark', f'{metric}_0', f'{metric}_1', 'difference', 'percent']]
7070

7171
# Compute the geomean and report on their difference
72-
geomean_0 = statistics.geometric_mean(data[f'{metric}_0'])
73-
geomean_1 = statistics.geometric_mean(data[f'{metric}_1'])
72+
geomean_0 = statistics.geometric_mean(data[f'{metric}_0'].dropna())
73+
geomean_1 = statistics.geometric_mean(data[f'{metric}_1'].dropna())
7474
geomean_row = ['Geomean', geomean_0, geomean_1, (geomean_1 - geomean_0), (geomean_1 - geomean_0) / geomean_0]
75-
table.loc[len(table)] = geomean_row
75+
table.loc[table.index.max()] = geomean_row
7676

7777
return tabulate.tabulate(table.set_index('benchmark'), headers=headers, floatfmt=fmt, numalign='right')
7878

0 commit comments

Comments
 (0)