-
Notifications
You must be signed in to change notification settings - Fork 331
FIX: Implement caching for InputControlPath display name #2342
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
base: develop
Are you sure you want to change the base?
FIX: Implement caching for InputControlPath display name #2342
Conversation
Cache the display name for InputControlPath to reduce GC churn.
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.
Pull request overview
This PR implements caching for InputControlPath display names to reduce unnecessary garbage collection churn. The change addresses a TODO comment by storing the computed display name and only recalculating it when the input path string actually changes.
Changes:
- Added caching mechanism with string comparison to avoid redundant
ToHumanReadableStringcalls - Introduced two cache fields (
m_CachedPathandm_CachedDisplayName) to track the last computed values
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs
Show resolved
Hide resolved
Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs
Outdated
Show resolved
Hide resolved
PR Code Suggestions ✨Explore these optional code suggestions:
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr |
|||||||||
Fixed caching for InputControlPath display name.
…r/InputControlPathEditor.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr |
PR Code Suggestions ✨Explore these optional code suggestions:
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr |
|||||||||
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop #2342 +/- ##
========================================
Coverage 77.95% 77.96%
========================================
Files 476 476
Lines 97453 97434 -19
========================================
- Hits 75971 75964 -7
+ Misses 21482 21470 -12
🚀 New features to boost your workflow:
|
Description
Purpose of this PR is to fix the TODO by caching per path value and only recompute when the string actually changes.
Testing status & QA
Check that it works as before, when inputing in the
InputControlPath.Overall Product Risks
Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.
Comments to reviewers
Please describe any additional information such as what to focus on, or historical info for the reviewers.
Checklist
Before review:
Changed,Fixed,Addedsections.Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.During merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.