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

Use ConcurrentDictionary For Improving GetEnumFromDisplayName #1809

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

Mahdigln
Copy link

No description provided.

@darrelmiller
Copy link
Member

Is this change for perf reasons? Do you have any benchmarks for what the perf difference is between these solutions?

@Mahdigln
Copy link
Author

Is this change for perf reasons? Do you have any benchmarks for what the perf difference is between these solutions?

I ran the benchmark with each method executed 1,000,000 times to simulate a high-usage scenario. This large number of iterations helps highlight the performance difference between the two approaches. Here's how the times break down:

Without cache: 2230 ms for 1,000,000 executions.
With cache: 63 ms for 1,000,000 executions.

This shows the significant advantage of using caching when dealing with repeated reflection operations

@darrelmiller
Copy link
Member

That seems like a pretty significant improvement. Thank you for the work.

@darrelmiller
Copy link
Member

/cc @MaggieKimani1

@Mahdigln
Copy link
Author

Mahdigln commented Oct 4, 2024

That seems like a pretty significant improvement. Thank you for the work.

Glad it was helpful! Hope to contribute more in the future.

@MaggieKimani1 MaggieKimani1 merged commit dfd6aeb into microsoft:vnext Oct 8, 2024
6 checks passed
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.

3 participants