- Notifications
You must be signed in to change notification settings - Fork5.2k
Optimize the initialization of the OrdinalCasing::s_sCasingTable table.#46061
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The table was initialized in the .cctor and it contains a large amount of object references, so the generated cctor was1K IL. Replace with a byte table and a loop.Fixesdotnet#43732.
ghost commentedDec 15, 2020
Tagging subscribers to this area:@tarekgh,@safern,@krwq Issue DetailsThe table was initialized in the .cctor and it contains a large amount of object references, so the generated cctor was Fixes#43732.
|
src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
vargaz commentedDec 15, 2020
Updated based on comments. |
src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
tarekgh commentedDec 15, 2020
@vargaz could you please have some perf benchmark numbers before and after your changes? just to ensure there is no perf effect? |
src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
| for(inti=0; i<s_casingTableInit.Length*8;++i) | ||
| { | ||
| // The bits are in reverse order | ||
| byteval=(byte)(s_casingTableInit[i/8]>>(7-(i%8))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
make 8 a local const?
src/libraries/System.Private.CoreLib/src/System/Globalization/OrdinalCasing.Icu.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
tarekgh left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@vargaz thanks for getting this fix.
I am approving it but would be good if you can include some benchmark numbers before and after the change. I am not expecting any perf regression but I want to ensure nothing will surprise us.
vargaz commentedDec 17, 2020
Will try, just have trouble running the benchmarks. |
vargaz commentedDec 17, 2020
Which public api ends up in this code path ? |
marek-safar commentedDec 17, 2020
I don't think there is much to be measured, you changed a code which is called once. |
The table was initialized in the .cctor and it contains a large amount of object references, so the generated cctor was
1K IL. Replace with a byte table and a loop.
Fixes#43732.