Questions about how to improve performance of my code
I am using requestAnimationFrame to repeatedly run a function, and inside that function I make a lot of function calls, so that things are organized, is that bad for performance? Should I write everything directly inside the animation function instead so that it doesn't have to look for the functions? Also, is using canvas save() and restore() methods a lot also effecting the performance? Should I just change all the style properties of the canvas myself? Lastly, is it bad that I have added two different touch events to the window? I created one that runs a code for the joysticks and I added another touch event later that checks wether some buttons have been clicked or not, is this bad for the performance? Should I merge the code into only one event listener?