Optimize conversion of Key enum from/to string, reduce allocations#9697
Merged
Conversation
h3xds1nz
commented
Sep 1, 2024
h3xds1nz
commented
Sep 1, 2024
harshit7962
reviewed
Dec 30, 2024
harshit7962
reviewed
Dec 30, 2024
harshit7962
previously approved these changes
Dec 30, 2024
Member
harshit7962
left a comment
There was a problem hiding this comment.
LGTM.
@h3xds1nz, could you please address the minor nits and the merge conflict? Let me know if you’d like me to resolve the conflicts.
20846b3 to
ae7bac8
Compare
Member
Author
|
@harshit7962 Thanks, merge conflicts fixed. I've additionally fixed the word "representation" on two occurrences as I've misspelled it. |
harshit7962
approved these changes
Dec 30, 2024
Member
harshit7962
left a comment
There was a problem hiding this comment.
Reapproving post resolution of conflicts and review comments.
Member
|
Thank you @h3xds1nz for the contribution and prompt resolution of conflicts. |
Member
Author
|
@harshit7962 Thank you for reviewing; if we could queue up #9683 (already went through test pass) for review I could get started on MouseGesture/KeyGesture converters finally. |
Member
|
Sure, will prioritize #9683 along with other PRs that you have mentioned already. |
This was referenced Jan 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Parsing optimization for
Keyand its conversion from/to string. Conversion from is now alloc-free, conversion to is either untouched or free.ConvertFromis now allocation free, optimizing performance from x4 for normal keys to x20 for F1-F12 keys.ConvertTois pretty much unchanged however F10-F12 were added to switch as those are interned.ConvertFrom benchmarks (code size is not real here 'cause depth is set to 1)
ConvertTo benchmarks
Customer Impact
Increased performance, zero/reduced allocations.
Regression
No.
Testing
Local build, CI, assert tests:
Risk
Low, changes have been thoroughly tested.
Microsoft Reviewers: Open in CodeFlow