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

Add plot_benchmarks scripts #806

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marxin
Copy link

@marxin marxin commented Mar 5, 2025

The script is intended for a collection of hyperfine JSON files where multiple benchmarks were run for a selected group of commands.

There are various projects that use such graphs:

https://github.com/rui314/mold?tab=readme-ov-file#mold-a-modern-linker
https://github.com/gimli-rs/addr2line?tab=readme-ov-file#performance

A sample output graph from the suggested script:
linker-benchmark

The script is intended for a collection of hyperfine JSON files where
multiple benchmarks were run for a selected group of commands.
import matplotlib.pyplot as plt
import numpy as np

parser = argparse.ArgumentParser(description=__doc__)
Copy link
Owner

@sharkdp sharkdp Mar 9, 2025

Choose a reason for hiding this comment

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

Should the comment above be a docstring in order for this to work?

Comment on lines +21 to +23
parser.add_argument(
"files", nargs="+", type=pathlib.Path, help="JSON files with benchmark results"
)
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe we could add a note here that all files must include results with the same commands? Or maybe that should be described in the top-level doc string?

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

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

This looks great, thank you very much. Can we maybe find a more descriptive name for this script? Maybe something like plot_benchmark_comparison or plot_grouped_comparison?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants