| 123 | |
| 124 | |
| 125 | def run_benchmark(profile: str, data_path: Path) -> float: |
| 126 | binary_dir = PROFILE_TARGET_DIR.get(profile) |
| 127 | if not binary_dir: |
| 128 | raise ValueError(f"unknown profile '{profile}'") |
| 129 | binary_path = REPO_ROOT / "target" / binary_dir / BENCHMARK_BINARY |
| 130 | if not binary_path.exists(): |
| 131 | raise FileNotFoundError(f"compiled binary not found at {binary_path}") |
| 132 | |
| 133 | command = [ |
| 134 | str(binary_path), |
| 135 | "tpch", |
| 136 | "--iterations", |
| 137 | str(DEFAULT_ITERATIONS), |
| 138 | "--path", |
| 139 | str(data_path), |
| 140 | "--format", |
| 141 | DEFAULT_FORMAT, |
| 142 | ] |
| 143 | if DEFAULT_PARTITIONS is not None: |
| 144 | command.extend(["--partitions", str(DEFAULT_PARTITIONS)]) |
| 145 | env = os.environ.copy() |
| 146 | env.setdefault("RUST_LOG", "warn") |
| 147 | |
| 148 | start = time.perf_counter() |
| 149 | try: |
| 150 | subprocess.run(command, cwd=REPO_ROOT, env=env, check=True) |
| 151 | except subprocess.CalledProcessError as exc: |
| 152 | raise RuntimeError(f"benchmark failed for profile '{profile}'") from exc |
| 153 | return time.perf_counter() - start |
| 154 | |
| 155 | |
| 156 | def binary_size(profile: str) -> int: |