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

Initial ScottPlotExporter with just Bar Plot and Unit Tests #2560

Merged
merged 6 commits into from
Jul 20, 2024

Conversation

FlatlinerDOA
Copy link
Contributor

This adds a new project called BenchmarkDotNet.Exporters.Plotting.

Currently just supports Bar Plots with configurable options for Width, Height and whether to RotateLabels (for large bar labels defaults to true).

Example Bar Plot:
MockSummary-Escape_ParamsAndArguments-barplot

NOTE: Currently build gets an error about strong naming?

@FlatlinerDOA
Copy link
Contributor Author

@dotnet-policy-service agree

@FlatlinerDOA
Copy link
Contributor Author

Hey @timcassell and @AndreyAkinshin just checking in for a status update on this one. I'm happy for any feedback. My plan was to add the rest of the charts that the R plot has once this PR was accepted.

Copy link
Collaborator

@timcassell timcassell left a comment

Choose a reason for hiding this comment

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

LGTM, but @AndreyAkinshin controls the Nuget packages, so he'll need to approve this and get it on Nuget.

@AndreyAkinshin AndreyAkinshin merged commit e933bb0 into dotnet:master Jul 20, 2024
8 checks passed
@AndreyAkinshin
Copy link
Member

@FlatlinerDOA thanks!

@AndreyAkinshin AndreyAkinshin added this to the v0.14.0 milestone Jul 20, 2024
@nietras
Copy link
Contributor

nietras commented Aug 11, 2024

I have been trying out this new ScottPlotExporter but getting some weird results. Perhaps I am using it wrong?

var exporter = new ScottPlotExporter();
var logger = new AccumulationLogger();
var summaries = BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(args);
foreach (var summary in summaries)
{
    var filePaths = exporter.ExportToFiles(summary, logger).ToList();
    WriteLine(string.Join(Environment.NewLine, filePaths));
}
BenchmarkDotNet v0.14.0, Windows 10 (10.0.19044.3086/21H2/November2021Update)
AMD Ryzen 9 5950X, 1 CPU, 32 logical and 16 physical cores
.NET SDK 8.0.303
  [Host]     : .NET 8.0.7 (8.0.724.31311), X64 RyuJIT AVX2 [AttachedDebugger]
  DefaultJob : .NET 8.0.7 (8.0.724.31311), X64 RyuJIT AVX2


| Method                                  | Mean       | Error     | StdDev    | Ratio | Gen0   | Allocated | Alloc Ratio |
|---------------------------------------- |-----------:|----------:|----------:|------:|-------:|----------:|------------:|
| PlainStruct_DictionaryGet               | 171.754 ns | 1.1416 ns | 1.0678 ns |  1.00 | 0.0110 |     184 B |        1.00 |
| EquatableStruct_DictionaryGet           |  35.244 ns | 0.0589 ns | 0.0551 ns |  0.21 | 0.0019 |      32 B |        0.17 |
| HashStruct_DictionaryGet                | 131.498 ns | 0.6998 ns | 0.6546 ns |  0.77 | 0.0091 |     152 B |        0.83 |
| HashEquatableStruct_DictionaryGet       |   5.831 ns | 0.0057 ns | 0.0050 ns |  0.03 |      - |         - |        0.00 |
| ValueTuple_DictionaryGet                |  14.810 ns | 0.0231 ns | 0.0216 ns |  0.09 |      - |         - |        0.00 |
| RecordStruct_DictionaryGet              |   7.299 ns | 0.0215 ns | 0.0191 ns |  0.04 |      - |         - |        0.00 |
| HashEquatableRecordStruct_DictionaryGet |   5.916 ns | 0.0143 ns | 0.0134 ns |  0.03 |      - |         - |        0.00 |

DictionaryBench-20240811-134553-DictionaryBench-barplot

@FlatlinerDOA
Copy link
Contributor Author

Thanks @nietras, it's plotting the mean of all measurements (including warmup). I've logged an issue #2611 and created a PR to fix it.

@nietras
Copy link
Contributor

nietras commented Aug 12, 2024

@FlatlinerDOA not sure I fully follow given what I show is way off from plot, e. g. PlainStruct has mean +170 ns but nothing in plot is anywhere near that, all values around 10-12ns... that is they are much lower.

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.

4 participants