[Java.Interop.Tools.Cecil] avoid File.Exists()
check in DirectoryAssemblyResolver
#1065
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.
dotnet-trace
of adotnet new maui
app:Shows some interesting time spent in:
For
LoadAssembly()
, the common case is that the files always exist, and the rare case they would be missing. Instead of callingFile.Exists()
on every assembly, we can handleFileNotFoundException
andreturn null
appropriately.For
ReadAssembly()
we can reorder the check for symbol files:So we check for
.pdb
files first, which should more likely exist in modern projects. We could drop.mdb
file checks at some point, when this code isn't shared with classic Xamarin.Android.Testing the changes afterward:
There appears to be some variance in the timing, but my rough estimate is this saves about 15-20ms on incremental builds of
dotnet new maui
projects. Larger projects could potentially save more.