Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add plotting to benchmark suites #94

Closed
wants to merge 1 commit into from
Closed

Conversation

daiwaid
Copy link
Collaborator

@daiwaid daiwaid commented Aug 26, 2024

What this PR does / why we need it:

  • Add plotting to benchmark suites; use --plot flag to plot from the last benchmark suite run results.

Which issue(s) this PR addresses (if any):

Addresses #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

- Add --plot flag to the benchmark module to plot the last benchmark suite run
- New benchmark suite runs will automatically save plots to 

@daiwaid daiwaid added the feat label Aug 26, 2024
@daiwaid daiwaid requested a review from zenodflow August 26, 2024 21:34
if args.plot:
files = list(os.scandir(bm.result_dir))
for file in reversed(files):
if file.name[26:-4].replace('35', '3.5') == name:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is 26:-4?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to extract the suite name from the result file (remove date and .csv).

@@ -35,7 +46,7 @@ def run(args):
print(f"Benchmark: Suite done in: {time.time() - start:.2f}s.")

df = report_to_dataframe(reports)
save(df, name)
file_name = save(df, name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here could be simplified by introducing a load call in the if args.plot?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with that is we still need to pass the .csv file name into plot() so it can save the plot with the same name as the result. We can't generate the file name like here because in the if args.plot part, we are using an old result so the timestamp will be wrong if we just pass in the DataFrame.

Copy link
Contributor

@zenodflow zenodflow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work - just wonder if the logic can be simplified a bit.

@daiwaid daiwaid force-pushed the feat-benchmark-plot branch from 4fe75f9 to 59bce00 Compare August 27, 2024 17:49
@daiwaid
Copy link
Collaborator Author

daiwaid commented Aug 30, 2024

Improved version in PR #95.

@daiwaid daiwaid closed this Aug 30, 2024
@daiwaid daiwaid added the duplicate This issue or pull request already exists label Aug 30, 2024
@daiwaid daiwaid deleted the feat-benchmark-plot branch August 30, 2024 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists feat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants