fix: convert benchmark chart bars from scores to execution times

The benchmark HTML output previously displayed abstract "score" values and scaled bars by the highest score. This change replaces scores with the actual minimum execution time in seconds (e.g., "0.15s") and scales bar widths proportionally to the highest time, making the charts directly interpretable as performance comparisons. The `run_bench` script now computes `time` from `min(result["times"])` instead of `get_score()`, and the static performance documentation is updated to reflect the new time-based values.
This commit is contained in:
Bob Nystrom
2015-01-17 01:51:10 +00:00
parent 0c0f900cad
commit 222cddc751
2 changed files with 33 additions and 33 deletions
+7 -7
View File
@@ -229,25 +229,25 @@ def print_html():
print('<h3>{}</h3>'.format(name))
print('<table class="chart">')
# Scale everything by the highest score.
# Scale everything by the highest time.
highest = 0
for language, result in results[benchmark].items():
score = get_score(min(result["times"]))
if score > highest: highest = score
time = min(result["times"])
if time > highest: highest = time
languages = sorted(results[benchmark].keys(),
key=lambda lang: results[benchmark][lang]["score"], reverse=True)
for language in languages:
result = results[benchmark][language]
score = int(result["score"])
ratio = int(100 * score / highest)
time = float(min(result["times"]))
ratio = int(100 * time / highest)
css_class = "chart-bar"
if language == "wren":
css_class += " wren"
print(' <tr>')
print(' <th>{}</th><td><div class="{}" style="width: {}%;">{}&nbsp;</div></td>'.format(
language, css_class, ratio, score))
print(' <th>{}</th><td><div class="{}" style="width: {}%;">{:4.2f}s&nbsp;</div></td>'.format(
language, css_class, ratio, time))
print(' </tr>')
print('</table>')