You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is cost close to 10kb on the disc. It should be possible to optimize this to reduce the size as the data are in a very narrow range (low case ASCII only).
@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.
do you suggest we compress it and expand it at runtime
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 s_lcids, s_localeNamesIndices arrays with something like
staticReadOnlySpan<byte>values=>newbyte[]{// "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 examplestaticreadonly int[] s_lcids =newint[]{// 16bit LCID | index into string values | string value length0x10|0<<12|7<<4,// az-cyrl0xbb|0<<12|2<<4,// az};
There is a dependency from c_localeNames but that could be improved as well
Reacted by Tarek Mahmoud Sayed and Santiago Fernandez Madero
Activity
tarekgh commentedon Nov 23, 2020
[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.
krwq commentedon Nov 24, 2020
@tarekgh I think suggestion might be to use UTF-8 or ASCII rather than UTF-16, that should remove almost half of the bytes
marek-safar commentedon Nov 24, 2020
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
s_lcids,s_localeNamesIndicesarrays with something likeThere is a dependency from
c_localeNamesbut that could be improved as wellOptimize storage of icu locale data
Optimize storage of icu locale data (#45296)