CARVIEW |
Select Language
HTTP/2 200
date: Sun, 27 Jul 2025 15:38:08 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/dotnet/android.git
etag: W/"187b05df15f2f6ecbd440115f70ee7aa"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=6QUyjS4gmca9n9AtsaPNdP%2BlDyJRr0BqMggL9xyMUpA6viVjBC%2F0xO8gUfqJeli%2FBHQaPcnzneILebBOOqPq96S%2BCPJQI%2FnqyIv5Jckm4OlDOs9plDOSTVClokN3Mbxi82idhtN24dqC8tjGjW36m2uAjI%2FSQe6WKvNO5xzk3PXXXSONqyQTNjiE6%2BX5pCSX3NV4hpTEBFiRuxcWNfOvKp4DTzjYFOsb8gbnO3hpPwE0oaIx6eTvL2nitwPOrRiZwq%2B8105Q%2FmgR2kphF0XoVw%3D%3D--78h4DJFk1q2uBMSD--w2NJOF0yFNpXktaD%2B4lNVg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.98891452.1753630687; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 15:38:07 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 15:38:07 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: EB04:0A77:33D9D0:41A6CD:688647DF
[Xamarin.Android.Build.Tasks] more ConvertResourcesCases improvements… · dotnet/android@f7769ef · GitHub
Copy file name to clipboardExpand all lines: src/Xamarin.Android.Build.Tasks/Utilities/AndroidResource.cs
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 555
Commit f7769ef
[Xamarin.Android.Build.Tasks] more ConvertResourcesCases improvements (#2328)
Context: https://www.getcodetrack.com/
I used a "freeware" .NET profiler to see what it would turn up.
Using the tool, I profiled the following .NET process:
.\bin\Debug\bin\xabuild.exe .\tests\Xamarin.Forms-Performance-Integration\Droid\Xamarin.Forms.Performance.Integration.Droid.csproj /v:quiet
This seemed to have a lot of useful information, and I quickly noticed:
Monodroid.AndroidResource.UpdateXmlResource -> 3683 calls -> 2.13s
..
Monodroid.AndroidResource.ResourceNeedsToBeLowerCased -> 2384 calls - 319.53ms
This is a known codepath, the `ConvertResourcesCases` MSBuild task,
that we know takes a bit of time.
Looking through the call stack, I saw two points we could make easy
fixes for:
- A `Regex` in `AndroidResource` was not using `RegexOptions.Compiled`
- There was a string append `dirPrefix + "*"` in a LINQ expression
that could be done up front.
- There was a bit of LINQ usage such as:
if (Directory.EnumerateDirectories (resourceBasePath, dirPrefix + "*").Any (dir => Directory.EnumerateFiles (dir, fileNamePattern).Any ()))
So I added `RegexOptions.Compiled` and converted the LINQ expressions
to `foreach` loops. I could see a noticeable change in these methods
which moved further down the list of methods, when sorted by time
duration.
But since the time differences *in the profiler* likely aren't going
to reflect the real world, I did a before/after comparision with the
Xamarin.Forms.ControlGallery project.
Project here:
https://github.com/jonathanpeppers/Xamarin.Forms/tree/msbuild-timing/Xamarin.Forms.ControlGallery.Android
Script here:
https://github.com/jonathanpeppers/msbuild-timing/blob/master/xamarin.forms.ps1
Before:
7224 ms ConvertResourcesCases 6 calls
After:
7034 ms ConvertResourcesCases 6 calls
So about a 200ms improvement on Windows, for adjusting a bit of code.
I suspect the improvement won't be as good on MacOS, since I don't
believe `RegexOptions.Compiled` is implemented in Mono. (It is safely
ignored)
Other changes:
- Code such as `(value ?? String.Empty).Trim ();`
- Simplified to `value?.Trim ();`
- Removed unused `filePath` variable
Future changes:
It may be worth auditing all regexes and adding
`RegexOptions.Compiled` if they appear to be called a lot?1 parent fa57aa8 commit f7769efCopy full SHA for f7769ef
File tree
Expand file treeCollapse file tree
1 file changed
+20
-13
lines changedFilter options
- src/Xamarin.Android.Build.Tasks/Utilities
Expand file treeCollapse file tree
1 file changed
+20
-13
lines changedsrc/Xamarin.Android.Build.Tasks/Utilities/AndroidResource.cs
Copy file name to clipboardExpand all lines: src/Xamarin.Android.Build.Tasks/Utilities/AndroidResource.cs+20-13Lines changed: 20 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
40 |
| - | |
| 40 | + | |
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
| |||
104 | 104 |
| |
105 | 105 |
| |
106 | 106 |
| |
107 |
| - | |
108 |
| - | |
| 107 | + | |
| 108 | + | |
109 | 109 |
| |
110 | 110 |
| |
111 | 111 |
| |
112 |
| - | |
113 |
| - | |
| 112 | + | |
| 113 | + | |
114 | 114 |
| |
115 | 115 |
| |
116 | 116 |
| |
117 | 117 |
| |
118 | 118 |
| |
119 | 119 |
| |
120 | 120 |
| |
121 |
| - | |
122 | 121 |
| |
123 | 122 |
| |
124 | 123 |
| |
125 | 124 |
| |
126 | 125 |
| |
127 | 126 |
| |
128 |
| - | |
| 127 | + | |
129 | 128 |
| |
130 | 129 |
| |
131 |
| - | |
132 |
| - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
133 | 135 |
| |
134 | 136 |
| |
135 |
| - | |
136 |
| - | |
137 |
| - | |
138 |
| - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
139 | 146 |
| |
140 | 147 |
| |
141 | 148 |
| |
|
You can’t perform that action at this time.
0 commit comments