CHANGED: Expand Optimized Controls performance testing #1905
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
As part of investigations to fix ISXB-533 I decided to expand our performance testing around optimized controls. The goals of the PR are:
The PR and the review does not have the goal to solve the issues reported in the bug ticket yet. That will come in a follow-up PR.
Changes made
Using feature flags such as
USE_OPTIMIZED_CONTROLSandUSE_READ_VALUE_CACHINGhas the intention to improve performance. However, we have reports by users that that's not the case.Previously, our performance testing around this area only showed isolated improvements without calling
InputSystem.Update(). I added more tests that show the cases where performance is improved and degraded when using these flags. Specifically:InputControl.ReadValue()andInputSystem.Update()for Gamepad. Every 100 frames the read value is changed.InputControl.ReadValue()andInputSystem.Update()for Mouse. Every 100 frames the read value is changed.InputSystem.Update().InputControl.ReadValue(), with new values every frame, andInputSystem.Update()for a Gamepad.Currently, in all these tests
USE_OPTIMIZED_CONTROLSalways performs worse. That's due to an extra check being done when a build is created withDEVELOPMENT_BUILD. On release builds we do not have this performance cost, but it does show up when the profiler is run.However,
USE_READ_VALUE_CACHING, has performance improvements and also degradation. In essence, when control values change every frame, it will almost likely always result in a performance cost.Notes
Feel free to comment on the way testing is done. And if there's more tests that you feel like we could have, please do give feedback.
Checklist
Before review:
Changed,Fixed,Addedsections.([case %number%](https://issuetracker.unity3d.com/issues/...)).Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.During merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.