[Java.Interop.Tools.JavaCallableWrappers] use less System.Linq for CAs #1072
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.
Context: https://github.com/microsoft/dotnet-podcasts/tree/net8.0
When building the .NET Podcast sample for .NET 8, profiling an incremental build with a
.xaml
change I noticed:There was a double-nested usage of System.Linq via a
GetBaseConstructors()
method, so I "unrolled" this to a plainforeach
loop.After this change:
This made me review places using System.Linq
.Any()
calls:Which I was able to track down to calls to an extension method like:
I created a new
CustomAttributeProviderRocks.AnyCustomAttributes()
extension method, which is a bit better because:We avoid a
yield return
& related compiler machinery.We avoid allocating custom attribute objects in some cases, as System.Linq's
Any()
will enumerate and create at least one.Before:
After:
These changes are about:
Overall, saving about ~34ms for incremental builds of the .NET podcast app.