Commit 526172b
authored
[Xamarin.Android.Build.Tasks]
Context: #8421
Working a bit on build performance, I tested:
* `dotnet new maui`
* `dotnet build -bl`
The `.binlog` shows:
LinkAssembliesNoShrink 3.797s
Attaching `dotnet-trace` as mentioned on:
https://github.com/xamarin/xamarin-android/blob/2f192386e8072f8e0ecaf0de2fe48654f3ade423/Documentation/guides/tracing.md#how-to-dotnet-trace-our-build
I see time broken down such as:
FixAbstractMethods: 37%
AssemblyDefinition.Write: 27%
ProcessAssemblyDesigner: 20%
CopyIfChanged: 13%
DirectoryAssemblyResolver.GetAssembly: 4.4%
This made me focus in on `FixAbstractMethodsStep` and make the
following changes:
* All calls for `TypeReference.Resolve()` and
`MethodReference.Resolve()` should go through the
`TypeDefinitionCache` to avoid repeated lookups.
* `IsInOverrides()` can compare the `MethodReference.Name` before
calling `Resolve()`. It could resolve many unnecessary methods
otherwise.
After these changes, I instead see from `dotnet-trace`:
--1.45s (3.7%) xamarin.android.build.tasks!MonoDroid.Tuner.FixAbstractMethodsStep.FixAbstractMethods()
++949.70ms (2.5%) xamarin.android.build.tasks!MonoDroid.Tuner.FixAbstractMethodsStep.FixAbstractMethods()
Time is now broken down differently, such as:
AssemblyDefinition.Write: 31%
FixAbstractMethods: 28%
ProcessAssemblyDesigner: 23%
CopyIfChanged: 12%
DirectoryAssemblyResolver.GetAssembly: 4.8%
In an overall `.binlog` (without `dotnet-trace` attached):
--LinkAssembliesNoShrink 3.797s
++LinkAssembliesNoShrink 3.105s
This saved ~700ms on initial build of a new MAUI project.FixAbstractMethodsStep performance (#8650)1 parent dbefbad commit 526172b
File tree
1 file changed
+5
-5
lines changed- src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner
1 file changed
+5
-5
lines changedLines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
| 255 | + | |
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| |||
0 commit comments