Dearest Community :)
I'm writing a fun-app in Haxe & openFL and bumped into "ENTER_FRAME" event -and measuring time elapsed from last call-.
It looks something like this (in event handler function) :
currentTime = Lib.getTimer();
deltaTime = currentTime - previousTime;
previousTime = currentTime;
The question is, for a function called very frequently (once every frame) which one is better, which is "handled better by haxe" so to speak?
a) declare 'currentTime' and 'deltaTime' function-scope, so it gets destroyed/re-created(does it?) every frame
-or-
b) declare all three variables class-level (as private) so entering handler will just overwrite value stored in memory?
Can't really tell which one is better / optimal, especially not if it varies depending on scenario.
Thank you for your help in advance!
All the Best,
Mark