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:
+7
-7
@@ -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: {}%;">{} </div></td>'.format(
|
||||
language, css_class, ratio, score))
|
||||
print(' <th>{}</th><td><div class="{}" style="width: {}%;">{:4.2f}s </div></td>'.format(
|
||||
language, css_class, ratio, time))
|
||||
print(' </tr>')
|
||||
print('</table>')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user