Compare the results of a base and diff benchmark runs.
(
base: Path,
diff: Path,
)
| 259 | @click.argument("base", **Arg.base) |
| 260 | @click.argument("diff", **Arg.diff) |
| 261 | def compare( |
| 262 | base: Path, |
| 263 | diff: Path, |
| 264 | ) -> None: |
| 265 | """Compare the results of a base and diff benchmark runs.""" |
| 266 | |
| 267 | info(f'Compare experiment results between "{base}" and "{diff}"') |
| 268 | |
| 269 | try: |
| 270 | base_df = pd.read_csv(base, quoting=csv.QUOTE_MINIMAL).agg( |
| 271 | ["min", "median", "max"] |
| 272 | ) |
| 273 | |
| 274 | diff_df = pd.read_csv(diff, quoting=csv.QUOTE_MINIMAL).agg( |
| 275 | ["min", "median", "max"] |
| 276 | ) |
| 277 | |
| 278 | # compute diff/base quotient for all (metric, query) pairs |
| 279 | quot_df = diff_df / base_df |
| 280 | # append average quotient across all queries for each metric |
| 281 | quot_df.insert(0, "Avg", quot_df.mean(axis=1)) |
| 282 | |
| 283 | # TODO: use styler to color-code the cells |
| 284 | print("base times") |
| 285 | print("----------") |
| 286 | print(base_df.to_string()) |
| 287 | print("") |
| 288 | print("diff times") |
| 289 | print("----------") |
| 290 | print(diff_df.to_string()) |
| 291 | print("") |
| 292 | print("diff/base ratio") |
| 293 | print("---------------") |
| 294 | print(quot_df.to_string()) |
| 295 | except Exception as e: |
| 296 | raise click.ClickException(f"compare command failed: {e}") |
| 297 | |
| 298 | |
| 299 | # Utility methods |
no test coverage detected