dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.93k stars 530 forks source link

[Xamarin.Android.Build.Tasks] remove `HasClassFiles` checks #9293

Closed jonathanpeppers closed 2 months ago

jonathanpeppers commented 2 months ago

Context: https://github.com/dotnet/android/pull/2882

During an incremental build + deploy of a dotnet new maui project, I noticed time spent in:

62.52ms (1.8%) xamarin.android.build.tasks!Xamarin.Android.Tasks.DetermineJavaLibrariesToCompile.HasClassFiles(class System.String)

What's worse, is this happens once for build and again for deploy. Because there are 100+ .jar files, we are actively opening each one with libZipSharp to determine if there are any .class files.

In e6326dcb, we added the HasClassFiles() call to fix a problem with "Enhanced Fast Deployment". However, we have since completely removed this feature in:

Removing the HasClassFiles() method completely, should improve the inner loop by around 120ms for dotnet new maui projects.