Skip to content
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

[release/8.0.1xx] Avoid allocations from calls to CultureInfo.GetCultures #8232

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

github-actions[bot]
Copy link
Contributor

Backport of #8231 to release/8.0.1xx

/cc @marcpopMSFT @ToddGrun

A local profile taken during running the vsixinstaller on roslyn indicated this call was allocating quite heavily in the "devenv /updateconfiguration" process the vsixinstaller kicks off. DirectoryBasedTemplate.ParseLocFileName was allocating 8.1% of all allocations in that devenv process, nearly all of which comes from the CultureInfo.GetCultures call.

Instead of allocating all cultures and an array to hold them by calling CultureInfo.GetCultures, this code can use CultureInfo.GetCultureInfo with the requested culture name and use that result instead. Note that GetCultureInfo throws if the requested culture name isn't supported, so we need to catch the corresponding CultureNotFoundException.
@github-actions github-actions bot requested a review from a team as a code owner July 16, 2024 21:25
@Forgind Forgind merged commit 4a85a62 into release/8.0.1xx Aug 7, 2024
10 checks passed
@marcpopMSFT marcpopMSFT deleted the backport/pr-8231-to-release/8.0.1xx branch September 6, 2024 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants