Commit 30501c1
committed
[Xamarin.Android.Build.Tasks] lazily populate Resource lookup
Fixes: #7684
Comparing .NET 7 to main, I noticed:
.NET 7
Task LinkAssembliesNoShrink 4ms
main/.NET 8
Task LinkAssembliesNoShrink 101ms
Under `dotnet trace` a lot of the time was spent in:
94.74ms MonoDroid.Tuner.FixLegacyResourceDesignerStep.LoadDesigner()
Reviewing the code, I think we can "lazily" call the `LoadDesigner()`
method. It creates a `Dictionary` that isn't used until the
`FixBody()` method.
I also updated one log message to only log duplicates, as it was
logging hundreds of lines:
if (output.ContainsKey (key)) {
LogMessage ($" Found duplicate {key}");
} else {
output.Add (key, property.GetMethod);
}
Which also showed up in `dotnet trace`:
25.58ms Microsoft.Android.Build.Tasks.MSBuildExtensions.LogDebugMessage()
With these changes, I instead get:
Task LinkAssembliesNoShrink 5ms
Which is probably ~the same performance as before or plenty good enough!1 parent 8c24b8f commit 30501c1
2 files changed
Lines changed: 8 additions & 10 deletions
File tree
- src/Xamarin.Android.Build.Tasks
- Linker/MonoDroid.Tuner
- Tasks
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | 71 | | |
73 | 72 | | |
74 | 73 | | |
| |||
114 | 113 | | |
115 | 114 | | |
116 | 115 | | |
117 | | - | |
118 | | - | |
119 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
128 | 132 | | |
129 | 133 | | |
130 | 134 | | |
| |||
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | 70 | | |
73 | 71 | | |
74 | 72 | | |
| |||
140 | 138 | | |
141 | 139 | | |
142 | 140 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | 141 | | |
148 | 142 | | |
149 | 143 | | |
| |||
0 commit comments