-
Notifications
You must be signed in to change notification settings - Fork 5k
[EventGrid] Generate switch expressions instead of dictionary lookups #49426
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
[EventGrid] Generate switch expressions instead of dictionary lookups #49426
Conversation
Thank you for your contribution @danielmarbach! We will review the pull request and get back to you soon. |
Pinging @m-nash @jsquire @JoshLove-msft @weshaggard since you have reviewed / worked on the previous PR |
API change check API changes are not detected in this pull request. |
f837c2a
to
da46ab7
Compare
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.
Thanks for the enhancement @danielmarbach! It looks like there are some test failures. Can you please take a look?
@JoshLove-msft I looked at those on my machine on macos and they all passed on Net8 and net9 I can give it another look later |
@JoshLove-msft this should work. I missed the ordinal ignore case comparison |
@JoshLove-msft in case you are bored ;) #49445 |
This PR refactors the
SystemEventExtensions.AsSystemEventData
method by replacing the existing dictionary-based lookup with a switch expression. This change directly maps event type strings to their corresponding deserialization methods.While the performance gains are relatively small and mostly noticeable in microbenchmarks or hot-path scenarios, this change streamlines the code and enables the runtime to produce more efficient IL. The overall design remains functionally equivalent, ensuring a smooth transition without breaking existing functionality.
Assumptions
Before
After