Repository navigation
perf: Reduce #US heap size for not-implemented member stubs - #23270
Merged
Merged
Conversation
Contributor
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23270/wasm-skia-net9/index.html |
MartinZikmund
enabled auto-merge
May 14, 2026 09:35
Contributor
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23270/wasm-skia-net9/index.html |
Contributor
|
|
jeromelaban
approved these changes
May 14, 2026
ajpinedam
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Issue: closes #20968
PR Type:
💬 Other... (Performance / binary-size optimization)
What changed? 🚀
#US(user strings) was reported as over 50% ofUno.dll's size. The dominant contributor was the per-member"The member XXX is not implemented... visit https://aka.platform.uno/notimplemented"string baked into every auto-generated[NotImplemented]API stub. Each literal is unique (full member signature + URL-escaped anchor), so the CLR cannot dedupe them in the#USheap.This PR stops baking the message and instead emits a
callto a shared helper, passing only the minimal unique data:src/Uno.Foundation/Metadata/ApiInformation.cs—BuildNotImplementedMessage(type, memberName)builds the message at runtime;CreateNotImplementedException(type, memberName)is the throwing helper used byforceRaisestubs;TryRaiseNotImplementedreuses the shared builder and keys its log-once set ontype + "." + memberName.src/Uno.WinAppSDKSyncGenerator/Generator.cs— generated stubs now emitthrow ApiInformation.CreateNotImplementedException("Full.Type.Name", "MemberName(signature)"). The member name is stripped of its containing-type prefix and return type (both redundant — the type is passed as arg 1), which both shortens each string and lets identically-named members across types share a single#USentry.Generated/files — every baked message literal replaced with a helper call; zerovisit https://...notimplementedliterals remain in generated code.Example emitted call:
throw global::Windows.Foundation.Metadata.ApiInformation.CreateNotImplementedException("Microsoft.UI.Win32Interop", "GetWindowIdFromWindow(nint hwnd)");The only observable behavior change:
NotImplementedException/ log messages now readThe member GetWindowIdFromWindow(nint hwnd) is not implemented...with a clean#m=Full.Type.Name.GetWindowIdFromWindow(...)doc anchor.Size impact
Skia variant, summed across the five assemblies that contain
Generated/folders.Release:
Debug:
Combined: −7.45 MB across the five assemblies — −30.6% in Release, −26.6% in Debug. The absolute saving is the same in both configs (the
#USheap is unaffected by IL optimization); the percentage is higher in Release because the assemblies are otherwise smaller.Uno.dllalone drops ~61%. These are unstripped builds — trimmed Release/AOT apps benefit before trimming even runs.PR Checklist ✅
Screenshots Compare Test Runresults.