Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
reubeno committed May 12, 2024
1 parent 4a499d9 commit e806bd4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scripts/compare-benchmark-results.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def parse_benchmarks_results(file_path: str) -> Dict[str, Benchmark]:
added_by_test = test_test_names - base_test_names
common = base_test_names & test_test_names

print("# Performance Benchmark Report")

if common:
print(f"| {'Benchmark name':36} | {'Baseline (ns)':>13} | {'Test/PR (ns)':>13} | {'Delta (ns)':>13} | {'Delta %'} |")
print(f"| {'-' * 36} | {'-' * 13} | {'-' * 13} | {'-' * 13} | {'-' * 7}")
Expand All @@ -58,10 +60,14 @@ def parse_benchmarks_results(file_path: str) -> Dict[str, Benchmark]:

delta_percentage = (100.0 * delta_duration) / base_duration
delta_percentage_str = f"{delta_percentage:.2f}%"
if delta_percentage > 0:
delta_percentage_str = "+" + delta_percentage_str

print(f"| {name:36} | {base_duration:10} ns | {test_duration:10} ns | {delta_str:>10} ns | {delta_percentage_str:>7} |")
if delta_percentage < 0:
delta_percentage_str = "🟢 " + delta_percentage_str
elif delta_percentage > 0:
delta_percentage_str = "🟠 +" + delta_percentage_str
else:
delta_percentage_str = "⚪ " + delta_percentage_str

print(f"| `{name:36}` | `{base_duration:10} ns` | `{test_duration:10} ns` | `{delta_str:>10} ns` | `{delta_percentage_str:>7}` |")

if removed_from_base:
print("Benchmarks removed:")
Expand Down

0 comments on commit e806bd4

Please sign in to comment.