Add --import-json to combine results from separate runs (fixes #830)#894
Add --import-json to combine results from separate runs (fixes #830)#894leno23 wants to merge 1 commit into
Conversation
Allow importing a previous --export-json file so baseline and follow-up benchmarks can be compared in a single summary without manual math. Fixes sharkdp#830 Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 591af06162
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pub fn prepend_results(&mut self, mut imported_results: Vec<BenchmarkResult>) { | ||
| imported_results.append(&mut self.results); | ||
| self.results = imported_results; |
There was a problem hiding this comment.
Preserve explicit reference position when importing results
Prepending imported results here shifts all newly measured benchmarks to the right, but print_relative_speed_comparison still assumes self.results[0] is the --reference benchmark when --reference is set. In runs that combine --import-json and --reference, the first imported entry is treated as the reference instead of the command passed via --reference, which produces incorrect relative-speed ratios and summary text for that workflow.
Useful? React with 👍 / 👎.
Summary
Adds a
--import-json FILEoption to load benchmark results from a previous--export-jsonexport and include them in the summary and relative speed comparison of the current run.This supports the common workflow of benchmarking a baseline, applying a system change, and then benchmarking again — without manually comparing two separate hyperfine outputs.
Example:
Changes
--import-jsonCLI flag andOptions::import_jsonload_benchmark_results()(restores display command when omitted)Schedulerbefore running new benchmarksFixes #830
Test plan
cargo testMade with Cursor