Closed graham-huws closed 2 months ago
Added Paulius to help testing performance on Android
The original bug project crashes when built on my only Android testing phone (Xiaomi MI 8 Lite) so I used the QA mobile sensor testing project instead when idling and when interacting with the UI buttons. Not sure what to make of the results so I'm just gonna post the screenshot with analyzer data as well as profiler captures. Capture data
(In the screenshot blue highlighted area is for simply idling the app and the right green area is me pressing UI buttons every 0.5~ sec)
These captures don't show any significant slow down so I think this is good to land (pending reacting to feedback above in PR)
There is a slowdown on some frames for the PreUpdate.NewInputUpdate. 0.20 to 0.34 on one frame Only 2 frames show slow down more and 0.1
InputProcess has some slow down but its minimal 0.03 to 0.04
How many taps were made in this sample ?
For the past tapping captures I just profiled for 15~ secs and tapped twice every second, the number of taps could be different from both versions. Here's a brand new capture of me idling for 5 secs, tapping once -> idling for 5 secs more and tapping again. Both of these should now just be 2 taps each
I used this project: https://github.cds.internal.unity3d.com/unity/InputSystem-TestProject
Here's one of me just tapping non stop for around 15 secs
Here's one of me just tapping non stop for around 15 secs
Sorting by time and looking at the slowest 100 frames (when there is active tap interation) there is a small slowdown in InputUpdate 0.01ms (0.06->0.07ms). But this seems reasonable for the reliability improvement of the edge detection from the fix.
Have updated to address above comments, plus some extra issues that cropped up. Have added new perf results to the second sheet of the gdoc.
@lyndon-unity Could you help summarise what additional updates are needed to transition this from "Request Changes"?
Now updated to a new version which only does processing for ButtonControls which have had wasPressedThisFrame/wasReleasedThisFrame called, saving a lot of performance when not many are being utilised.
Added V2 benchmarks to the spreadsheet, and new tests which try varying amounts of buttons to test to see the impact.
Description
Fix for ISXB-491. The current design of the input system package relies on the following method for checking if a button has been pressed on the current frame: Check the current value of the button, and compare to the final value of the previous frame. The issue with this approach is that presses can be missed if they happened very quickly, or there was some form of lag making the update take longer than intended. Whether a button is pressed is only properly evaluated when asked, so if we don't check every input coming in, some can be missed.
Changes made
This PR seeks to solve this in a very simplistic way - check every value that affects ButtonControls and record their pressed state at the time the change comes in. Current belief is that a "clever" solution to this issue would require a fairly extensive rewrite of how the input system works. Performance comparison data can be viewed on Sheet 2 here.
Checklist
Before review:
Changed
,Fixed
,Added
sections.([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
.