Repository navigation
Avoid culture cache lookup in invariant predefined-only mode - #137333
Merged
MichalStrehovsky merged 1 commit intoNov 12, 2026
Merged
MichalStrehovsky merged 1 commit into
MichalStrehovsky merged 1 commit into
Conversation
Make the absence of user overrides explicit in CultureInfo.CompareInfo when both invariant globalization and predefined-only cultures are enabled. This lets NativeAOT trim the otherwise retained named-culture cache lookup. Preserve the existing sharing path when named invariant cultures are allowed. Standalone local HelloWorldSize probe, WASI NativeAOT Release, invariant globalization and size optimization: 722,933 -> 716,024 bytes, saving 6,909 bytes (0.96%) against the common base. Validated with clr.nativeaotlibs+libs.sfx and the HelloWorldSize build. HelloWorldSize ran under Wasmtime and exited 100. Co-authored-by: Copilot <[email protected]> Copilot-Session: 2e62c26c-6da8-442d-98ac-dcb988c2846a
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-globalization |
Member
Author
This was referenced Nov 11, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the globalization-mode guard change.
No open issues 🎉
What changed in this PR
This PR makes the invariant, predefined-only globalization path explicit in CultureInfo.CompareInfo, allowing NativeAOT to trim the unused named-culture cache lookup.
Changes:
- Bypasses the cache lookup when both invariant globalization and predefined-only cultures are enabled.
- Preserves existing
CompareInfosharing when named invariant cultures are allowed.
| File | Description |
|---|---|
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs |
Adds a globalization-mode guard to the CompareInfo getter to enable trimming. |
Review effort: Balanced
tarekgh
approved these changes
Nov 11, 2026
Member
Author
|
/ba-g timeout in the osx-arm64 leg but everything else looks good |
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.
Make the absence of user overrides explicit in CultureInfo.CompareInfo when both invariant globalization and predefined-only cultures are enabled. This lets NativeAOT trim the otherwise retained named-culture cache lookup. Preserve the existing sharing path when named invariant cultures are allowed.
Standalone local HelloWorldSize probe, WASI NativeAOT Release, invariant globalization and size optimization: 722,933 -> 716,024 bytes, saving 6,909 bytes (0.96%) against the common base.
Validated with clr.nativeaotlibs+libs.sfx and the HelloWorldSize build. HelloWorldSize ran under Wasmtime and exited 100.