From de10a859ae7988101b46d1cc017e9c2aebfd1e04 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Mon, 22 Jan 2024 23:30:21 +0300 Subject: [PATCH] perf: Array/Dictionary Improvement --- Engine.Input/KeyboardInputsBehaviour.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Engine.Input/KeyboardInputsBehaviour.cs b/Engine.Input/KeyboardInputsBehaviour.cs index cb29144..514214a 100644 --- a/Engine.Input/KeyboardInputsBehaviour.cs +++ b/Engine.Input/KeyboardInputsBehaviour.cs @@ -7,14 +7,14 @@ namespace Syntriax.Engine.Input; public class KeyboardInputsBehaviour : BehaviourOverride, IKeyboardInputs { - private IDictionary> OnPressed = new Dictionary>(256); - private IDictionary> OnReleased = new Dictionary>(256); + private readonly Dictionary> OnPressed = new(256); + private readonly Dictionary> OnReleased = new(256); private int cachePressedCurrentlyCount = 0; - private Keys[] cachePressedCurrently = new Keys[256]; + private readonly Keys[] cachePressedCurrently = new Keys[256]; private int cachePressedPreviouslyCount = 0; - private Keys[] cachePressedPreviously = new Keys[256]; + private readonly Keys[] cachePressedPreviously = new Keys[256]; public void RegisterOnPress(Keys key, Action callback) {