-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize storage for IcuLocaleData data #45129
Comments
Tagging subscribers to this area: @tarekgh, @safern, @krwq Issue DetailsThe massive string which is declared in runtime/src/libraries/System.Private.CoreLib/src/System/Globalization/IcuLocaleData.cs Line 32 in e2099f6
|
[edited comment] @marek-safar do you suggest we compress it and expand it at runtime? I think we can store it as ASCII encoding or store it as compressed binary and expand it at runtime. |
@tarekgh I think suggestion might be to use UTF-8 or ASCII rather than UTF-16, that should remove almost half of the bytes |
Yeah, story it more efficiently so we don't have a massive string in metadata and on a whole copy of it on the heap. Most apps will use a few lcid strings only anyway. There are numerous way how to do it one of them could be to replace static ReadOnlySpan<byte>values => new byte[] {
// "az" or "az-cyrl" or "az-cyrl-az"
(byte)'a', (byte)'z', (byte)'-', (byte)'c', (byte)'y', (byte)'r', (byte)'l', (byte)'-', (byte)'a', (byte)'z',
};
// LCID values don't match the real ones in this example
static readonly int[] s_lcids = new int[]
{
// 16bit LCID | index into string values | string value length
0x10 | 0 << 12 | 7 << 4, // az-cyrl
0xbb | 0 << 12 | 2 << 4, // az
}; There is a dependency from |
to reduce SPC size by about 10k and avoid allocating huge string on the heap Fixes dotnet#45129
* Optimize storage of icu locale data to reduce SPC size by about 10k and avoid allocating huge string on the heap Fixes #45129 * Formatting fixes
The massive string which is declared in
runtime/src/libraries/System.Private.CoreLib/src/System/Globalization/IcuLocaleData.cs
Line 32 in e2099f6
@eerhardt
The text was updated successfully, but these errors were encountered: