Garbage generated by InputDeviceManager

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
effalumper
Posts: 11
Joined: Wed Dec 11, 2024 9:09 am

Garbage generated by InputDeviceManager

Post by effalumper »

Hey,

I just wanted to highlight an issue I noticed recently in InputDeviceManager. I noticed I was getting frequent spiky frames due to GC, and one cause of garbage came from this component, from the DefaultGetKeyDown method. It generates garbage every frame as a result of using string.ToLower. I wonder if case-invariant checking is really necessary there? And if it is, I think it would be better to use something like:

Code: Select all

s.StartsWith("mouse", StringComparison.InvariantCultureIgnoreCase))
and

Code: Select all

string.Compare(s, "mouse0", true) == 0
to avoid this garbage generation. Not a big deal for me, as I think I actually don't need this component at all (at least I've found no bad side effects yet of removing it), but might be helpful for others as this component is I think included by default. Kind regards,

Andy
User avatar
Tony Li
Posts: 23376
Joined: Thu Jul 18, 2013 1:27 pm

Re: Garbage generated by InputDeviceManager

Post by Tony Li »

Hi,

Oops, didn't realize that was still in there. I'll make sure that's fixed in the next update.
Post Reply