Make a bit of BenchmarkDotNet trimmable #2046
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Another attempt at fixing the problem I tried to fix in #2020.
In that pull request, I reflection-rooted all of BenchmarkDotNet, but that looks like it increases the size of the closure too much (dotnet/performance#2532). So here I'm rolling that part back and annotating enough of the
Characteristic
APIs to make it so that we shouldn't run into the original problem.I basically added
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
to the BechmarkDotNet project, looked at the trimming warning inBenchmarkDotNet/src/BenchmarkDotNet/Characteristics/CharacteristicHelper.cs
Lines 49 to 68 in 63e28c1
We now have an annotation in a spot that should make sure the
Job
class has all fields and properties kept (it's used with one of the annotatedCreate
methods).There are more trimming warnings that I didn't try to solve because they're unrelated to the problem at hand.
Cc @adamsitnik
Cc @dotnet/ilc-contrib FYI