Skip to content

Commit

Permalink
getting rid of rich + using stdout instead of python print
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-keede committed Feb 14, 2025
1 parent 4f760a1 commit 5ed26d3
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions benchmarks/lineformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@
from typing import Dict, List, Any
from pathlib import Path
from argparse import ArgumentParser

try:
from rich.console import Console
from rich.table import Table
except ImportError:
print("Couldn't import modules -- run `./bench.sh venv` first")
raise
import sys
print = sys.stdout.write


@dataclass
Expand Down Expand Up @@ -104,7 +99,7 @@ def load_from_file(cls, path: Path) -> BenchmarkRun:
return cls.load_from(json.load(f))


def compare(
def lineformat(
baseline: Path,
) -> None:
baseline = BenchmarkRun.load_from_file(baseline)
Expand All @@ -114,7 +109,7 @@ def compare(
query_str = f"query=\"{query.query}\""
timestamp = f"{query.start_time*10**9}"
for iter_num, result in enumerate(query.iterations):
print(f"{benchamrk_str} {query_str},iteration={iter_num},row_count={result.row_count},elapsed_ms={result.elapsed*1000:.0f} {timestamp}")
print(f"{benchamrk_str} {query_str},iteration={iter_num},row_count={result.row_count},elapsed_ms={result.elapsed*1000:.0f} {timestamp}\n")

def main() -> None:
parser = ArgumentParser()
Expand All @@ -127,7 +122,7 @@ def main() -> None:

options = parser.parse_args()

compare(options.baseline_path)
lineformat(options.baseline_path)



Expand Down

0 comments on commit 5ed26d3

Please sign in to comment.