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

Enum.ToString method is resulting in slow performance. Fix it. #11229

Merged
merged 5 commits into from
Jan 8, 2025

Conversation

SimaTian
Copy link
Member

@SimaTian SimaTian commented Jan 6, 2025

Context

We recently merged #11202
While profiling, the VS profiler started complaining about the Enum.ToString() with a perf cost 0.14%
EnumToString
See also here:
https://learn.microsoft.com/en-us/visualstudio/profiling/performance-insights-enum-tostring?view=vs-2022

Changes Made

Introduced a function to do the conversion in a Reflection-less way.

@SimaTian SimaTian force-pushed the replace-enum-to-string branch from 3117080 to 878a618 Compare January 6, 2025 15:29
Copy link
Member

@surayya-MS surayya-MS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@SimaTian SimaTian merged commit 6ea6901 into main Jan 8, 2025
10 checks passed
@SimaTian SimaTian deleted the replace-enum-to-string branch January 8, 2025 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants