Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.82k stars 821 forks source link

TouchProcessor.enqueue creates a lot of arrays #1037

Closed subdan closed 5 years ago

subdan commented 5 years ago

Hello, Daniel.

I noticed that TouchProcessor class creates new array on every enqueue call.

_queue.unshift([1, phase, _touchMarker.mockX, _touchMarker.mockY]);

I think it will be better to create the array once and use it instead of creating new array on each enqueue call. Like this:

tempArray[0] = 1
tempArray[1] = phase
tempArray[2] = _touchMarker.mockX;
tempArray[3] = _touchMarker.mockY];
 _queue.unshift(tempArray);
subdan commented 5 years ago

I've found the same issue https://github.com/Gamua/Starling-Framework/issues/1025 So, the main issue is using _queue.unshift(arguments); Could you please fix it?

PrimaryFeather commented 5 years ago

Yeah, this finally needs to be addressed. You'll get an update tomorrow!

subdan commented 5 years ago

Thanks!

PrimaryFeather commented 5 years ago

I just made that change — please have a look and let me know it that works for you!

subdan commented 5 years ago

Thank you, Daniel!