Commit 97d250b
authored
[Xamarin.Android.Build.Tasks] perf improvements for <ResolveAssemblies/> (#4236)
When building the SmartHotel360 app, I found that
`<ResolveAssemblies/>` was loading the NuGet `ProjectAssetFile` /
`LockFile` even though it was not used by the task at all. Putting a
`Stopwatch` around the code, I also found it to be somewhat expensive.
I reworked the code to use a `Lazy<T>` for accessing the `LockFile`.
This way it is not actually loaded until it is needed.
I also found several `LogDebugMessage` calls that seemed to be too
much... The `<ResolveAssemblies/>` was emitting hundreds of lines of
logging in the SmartHotel360 app.
I removed two messages such as:
LogDebugMessage ($"Adding {resolved_assembly} to topAssemblyReferences");
...
LogDebugMessage ("{0}={1}", assemblyName, apiLevel);
The `[Input]` and `[Output]` values for the task and the remaining log
message should be sufficient for understanding what we need from
customer logs:
LogMessage ("{0}Adding assembly reference for {1}, recursively...", new string (' ', indent), assemblyName);
The results for a build with no changes with the SmartHotel360 app:
Before:
320 ms ResolveAssemblies 1 calls
After:
238 ms ResolveAssemblies 1 calls
This saves ~82ms, and since this task runs on every `Build` and
`Install`, it could save ~164ms from the dev-loop.1 parent 8acd915 commit 97d250b
1 file changed
+19
-11
lines changedLines changed: 19 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | 75 | | |
85 | 76 | | |
86 | 77 | | |
87 | 78 | | |
88 | 79 | | |
89 | 80 | | |
90 | 81 | | |
| 82 | + | |
91 | 83 | | |
92 | 84 | | |
93 | 85 | | |
| |||
96 | 88 | | |
97 | 89 | | |
98 | 90 | | |
99 | | - | |
100 | 91 | | |
101 | 92 | | |
102 | 93 | | |
| |||
158 | 149 | | |
159 | 150 | | |
160 | 151 | | |
| 152 | + | |
161 | 153 | | |
162 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
163 | 172 | | |
164 | 173 | | |
165 | 174 | | |
| |||
307 | 316 | | |
308 | 317 | | |
309 | 318 | | |
310 | | - | |
311 | 319 | | |
312 | 320 | | |
313 | 321 | | |
| |||
0 commit comments