FIX: Implement caching for InputControlPath display name#2342
FIX: Implement caching for InputControlPath display name#2342josepmariapujol-unity wants to merge 6 commits intodevelopfrom
Conversation
Cache the display name for InputControlPath to reduce GC churn.
There was a problem hiding this comment.
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.