Skip to content

Use ConcurrentDictionary For Improving GetEnumFromDisplayName - #1809

Merged
Maggie Kimani (MaggieKimani1) merged 1 commit into
microsoft:vnextfrom
Mahdigln:GetEnumFromDisplayName
Oct 8, 2024
Merged

Use ConcurrentDictionary For Improving GetEnumFromDisplayName#1809
Maggie Kimani (MaggieKimani1) merged 1 commit into
microsoft:vnextfrom
Mahdigln:GetEnumFromDisplayName

Conversation

@Mahdigln

Copy link
Copy Markdown
Contributor

No description provided.

@darrelmiller

Copy link
Copy Markdown
Member

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

@Mahdigln

Copy link
Copy Markdown
Contributor 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
Copy Markdown
Member

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

@darrelmiller

Copy link
Copy Markdown
Member
@Mahdigln

Mahdigln commented Oct 4, 2024

Copy link
Copy Markdown
Contributor Author

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

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

@MaggieKimani1
Maggie Kimani (MaggieKimani1) merged commit dfd6aeb into microsoft:vnext Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants