This commit is contained in:
2026-01-15 03:02:41 +03:00
parent 9bde1321e1
commit 3cd74fc186
2 changed files with 25 additions and 12 deletions
+21 -8
View File
@@ -1,7 +1,10 @@
from concurrent.futures import ProcessPoolExecutor
import os
from rich import Console
from rich.console import Console
from rich.table import Table
from rich.panel import Panel
from rich.text import Text
from metrics.utils import run_benchmark, BenchmarkResult
from .registry import Benchmarks, Benchmark
@@ -21,15 +24,25 @@ def main():
type_paired_benchmarks.setdefault(result.type_, []).append(result)
for type_, benchmarks in type_paired_benchmarks.items():
console.print('\n' + ('='*(len(type_)+14)))
console.print(f' TYPE: {type_.upper()}')
console.print('='*(len(type_)+14) + '\n')
header_text = Text(f"TYPE: {type_.upper()}", style="bold magenta")
console.print(Panel(header_text, expand=False, border_style="magenta"))
table = Table(show_header=True, header_style="bold cyan", border_style="blue", show_lines=True)
table.add_column("Name", style="green")
table.add_column("Description", style="dim")
table.add_column("Iterations", justify="right")
table.add_column("Avg Time (ms)", justify="right", style="bold yellow")
for benchmark in benchmarks:
console.print(f'Name: {benchmark.name}\n'
f'Description: {benchmark.description}\n'
f'Iterations: {benchmark.iterations}\n'
f'Average time per iteration: {benchmark.avg_time} ms\n')
table.add_row(
benchmark.name,
benchmark.description,
str(benchmark.iterations),
str(benchmark.avg_time)
)
console.print(table)
console.print()
if __name__ == "__main__":