New Input System is Slow

We have noticed that the Input System’s performance is suspect. Many others have noted the same, and there are threads dating back several years with comments by Unity folks saying some of the slowdowns are fixed. We have read through all that we’ve found and are still seeing very slow performance.

Note: while the Nintendo Switch platform is mentioned below, the issue appears to happen on all platforms, including in editor.

Unity version: 2023.2.20f1
Input System versions: 1.7.0, 1.82, and 1.10.0
Switch Input System Package Version: com.unity.inputsystem.switch@0.1.6-pre although I don’t think this is related

We have a new project that contains:

  • An InputActions with 2 control schemes (KBM and Gamepad), 1 Action Map (Player), and 3 simple Actions (Steer, Aim, and Pause) w/ NO Interactions or Processors
  • PlayerInputManager script that checks input two ways: 1. polling through Update (e.g. _steering = _inputActions.Player.Steer.ReadValue();), and 2: a function called from a Unity Event on the PlayerInput class (e.g. public void OnAim(InputAction.CallbackContext context))
  • Switch Input System package

The two main issues noticed:
1. Each app run, there’s a HUGE computation spike the first time input is processed (50+ms spike!)
3. Whenever input is used (e.g. moving a joystick, pressing a button, etc.) there is significant processing overhead (1-3 ms). The more inputs used at once (e.g. two joysticks pressed at the same time), the worse the overhead

We tried implementing the below tips and it shaves off maybe ~0.1 ms (~1.6ms → ~1.5ms per frame)

InputSystem.settings.SetInternalFeatureFlag("USE_OPTIMIZED_CONTROLS", true);
InputSystem.settings.SetInternalFeatureFlag("USE_READ_VALUE_CACHING", true);

Switching between Input System versions 1.7 → 1.82 → 1.10.0 didn’t make a noticeable difference. In fact, going from 1.7 → 1.82 seemed to make the input system take ~2-3 ms on Switch instead of 1-2 ms.

It doesn’t seem to matter whether we poll for the input or use Unity Events, the slowdown exists either way.

We know that profiling and debug builds are significantly slower than release builds, but this performance seems abnormally slow, even for debug builds.

Profiler CPU Usage debugging on Switch

It won’t let me embed more than one image or upload a zip of the empty project. Happy to send it to anyone that wants a copy.

Old posts we referenced:

First Input Spike Profiler Hierarchy

Two Joysticks Moving at Once