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 Moq.Analyzers.Benchmarks with a single sample benchmark #109

Merged
merged 13 commits into from
Jun 21, 2024

Conversation

MattKotsenas
Copy link
Collaborator

@MattKotsenas MattKotsenas commented Jun 21, 2024

Add the project Moq.Analyzers.Benchmarks with a sample benchmark for diagnostic Moq1300. This pattern is copied from https://github.com/dotnet/roslyn-analyzers/blob/f1115edce8633ebe03a86191bc05c6969ed9a821/src/PerformanceTests/Tests/Enabled/CSharp_CA1416.cs, but where possible I used the types exposed by the Microsoft.CodeAnalysis.*.Testing libraries instead.

As part of the exercise, I filed dotnet/roslyn-sdk#1165 to discuss if some of these helpers should move into the testing packages, and / or to document any existing profiling best practices.

This change doesn't attempt to hook the benchmarks into CI in any way; they're both currently too slow for that, and I'm not yet sure what (if anything) to gate on.

@MattKotsenas MattKotsenas requested a review from rjmurillo June 21, 2024 21:33
@MattKotsenas MattKotsenas enabled auto-merge (squash) June 21, 2024 22:19
Copy link
Owner

@rjmurillo rjmurillo left a comment

Choose a reason for hiding this comment

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

Step 2 would be getting this to show up in the action and building gates. Thanks for also taking care of some of those other warnings

@MattKotsenas MattKotsenas merged commit b181344 into rjmurillo:main Jun 21, 2024
4 of 5 checks passed
@MattKotsenas
Copy link
Collaborator Author

Here's a sample of the output:

| Method                 | Mean     | Error    | StdDev   | Median   | Ratio | RatioSD | Gen0      | Gen1      | Allocated | Alloc Ratio |
|----------------------- |---------:|---------:|---------:|---------:|------:|--------:|----------:|----------:|----------:|------------:|
| Moq1300WithDiagnostics | 378.6 ms | 12.70 ms | 37.26 ms | 371.9 ms |  1.80 |    0.29 | 9000.0000 | 3000.0000 |  58.72 MB |        1.37 |
| Moq1300Baseline        | 215.3 ms | 11.45 ms | 33.75 ms | 205.8 ms |  1.00 |    0.00 | 7000.0000 | 2000.0000 |  42.95 MB |        1.00 |

@MattKotsenas MattKotsenas deleted the feature/perf-harness branch June 21, 2024 22:32
@rjmurillo rjmurillo added the .NET Pull requests that update .net code label Jun 24, 2024
@rjmurillo rjmurillo added this to the vNext milestone Jun 24, 2024
@rjmurillo rjmurillo added the dependencies Pull requests that update a dependency file label Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file .NET Pull requests that update .net code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants