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

[WIP] Adding a througput chart to the benchmark summary. #315

Closed
wants to merge 10 commits into from

Conversation

gz
Copy link
Contributor

@gz gz commented Aug 21, 2019

A first version to address #149. This adds a throughput chart to the summary page.

Some more thoughts:

It was a bit of a nuisance to get the Throughput struct down to the reporting and plotting, maybe there is an easier, better way that I don't know?

Also, plot::line_comparison_throughput is doing unwrap on Option so the caller should check that every BenchmarkId has a throughput (and that its of the same type probably). I can add that if the general direction of this pull request is deemed fine.

Maybe, instead of a line-plot a barchart will work better here?

To test I use:

cargo bench -- from_elem
open target/criterion/report/index.html

@gz
Copy link
Contributor Author

gz commented Aug 21, 2019

It seems I got confused by the two structs report::BenchmarkId which has throughput and BenchmarkId which doesn't store throughput in benchmark_group.rs which I also mistakenly assumed I was passing around.
So I can simplify this pull request quite a bit.

@bheisler
Copy link
Owner

Hey, sorry I haven't had a chance to respond to this yet. Yeah, report::BenchmarkID is the way to go. I should also mention there's also a ValueFormatter::scale_for_throughput that I added specifically to support this; I haven't looked at the code changes yet so you may have seen that already.

Copy link
Owner

@bheisler bheisler left a comment

Choose a reason for hiding this comment

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

As you noticed, you can get the throughput out of the benchmark ID so all of the changes made to pass the throughput along are unnecessary. There's also some leftover debug output.

Otherwise this looks good. It won't make it into 0.3.0 (which I plan to release today) but it won't require a breaking change so we can add it to 0.3.1.

src/plot/summary.rs Outdated Show resolved Hide resolved
@gz gz changed the base branch from v0.3.0-dev to master August 26, 2019 23:01
src/html/mod.rs Outdated Show resolved Hide resolved
@gz
Copy link
Contributor Author

gz commented Aug 26, 2019

Thanks, I updated this pull request, let's see if it passes CI.

Copy link
Owner

@bheisler bheisler left a comment

Choose a reason for hiding this comment

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

Better! Just some minor things to clean up.

src/html/mod.rs Outdated Show resolved Hide resolved
src/plot/summary.rs Outdated Show resolved Hide resolved
src/plot/summary.rs Outdated Show resolved Hide resolved
@gz
Copy link
Contributor Author

gz commented Sep 23, 2019

Finally got around to addressing the reviews.

The build currently fails due to unrelated issues,should be fixed with #336

@gz gz requested a review from bheisler September 23, 2019 23:37
@gz
Copy link
Contributor Author

gz commented Sep 24, 2019

I changed the plotting for throughput slightly to take into account parameterized benchmarks.

Otherwise the summary plot may end up with different unit display as
the #elements can change for different benchmark.
Otherwise this leads to problem in graphs where we can have
different values in Throughput::Elements, or Throughput::Bytes
that lead to putting values in the same plot with different units.

However, after changing this I had to adjust the format_throughput
function because it would just use the raw time as a typical value
before which could lead to odd unit choices (like 2_000_000 Kelem/s).
With these changes, now the format_throughput also takes a typical value
that can be estimated in advance with Throughput::per_second().
Also finds the maximum tput for the plot properly by looking at
tput values and not just mean.
@Ekleog
Copy link

Ekleog commented May 15, 2020

Hey! Just wanted to ask if there's any news on this PR, as it'd be very nice :)

@gz
Copy link
Contributor Author

gz commented May 15, 2020

Hey, the branch/PR works/worked for me -- feel free to give it a try ... Unfortunately, I couldn't quite fit my requirements for a multi-core benchmark harness into criterion (even with iter_custom) so I am currently not actively relying on the patch but maybe @bheisler could still check if it's something for master if it's useful for you.

@h33p
Copy link

h33p commented May 27, 2020

It would be really nice to have this in. Although it fails to generate a plot for logarithmic scale (min yrange can't be zero). That should can be solved by removing set(Range::Limits(0, max_formatted[0]) (line 181 from summary.rs). If this is still of interest to @bheisler I could take over this and finish implementing the feature.

@bheisler
Copy link
Owner

Hey folks, thanks for your patience. Yeah, if someone else wants to take over and finish this off, that'd be great!

@lemmih
Copy link
Collaborator

lemmih commented Jul 26, 2021

It would be really nice to have this in. Although it fails to generate a plot for logarithmic scale (min yrange can't be zero). That should can be solved by removing set(Range::Limits(0, max_formatted[0]) (line 181 from summary.rs). If this is still of interest to @bheisler I could take over this and finish implementing the feature.

I'm ready to review if you take over this PR.

@lemmih lemmih marked this pull request as draft July 26, 2021 03:18
@lemmih lemmih changed the title Adding a througput chart to the benchmark summary. [WIP] Adding a througput chart to the benchmark summary. Jul 26, 2021
@lemmih
Copy link
Collaborator

lemmih commented Dec 28, 2021

Closing due to inactivity.

@lemmih lemmih closed this Dec 28, 2021
h33p pushed a commit to h33p/criterion.rs that referenced this pull request Jan 30, 2023
Fixes #149.

Fix issues from review in bheisler#315.

Fix throughput check and make plot a scatter instead of line plot.

Include ParameterizedBenchmark config string in plot label.

Plot label takes function parameterization into account.

Put deny warnings back.

Make unit decision only based on typical value.

Otherwise the summary plot may end up with different unit display as
the #elements can change for different benchmark.

Undeny warnings to avoid OsRng error.

Make throughput unit decision only based on typical_value.

Otherwise this leads to problem in graphs where we can have
different values in Throughput::Elements, or Throughput::Bytes
that lead to putting values in the same plot with different units.

However, after changing this I had to adjust the format_throughput
function because it would just use the raw time as a typical value
before which could lead to odd unit choices (like 2_000_000 Kelem/s).
With these changes, now the format_throughput also takes a typical value
that can be estimated in advance with Throughput::per_second().

Fix plot to have a line similar to line chart.

Also finds the maximum tput for the plot properly by looking at
tput values and not just mean.
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.

5 participants