You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While a bit strange, and while it doesn't affect everything, this seems to end up being faster for the most mundane of tests I've performed.
Some example code I've tested goes as follows:
This cuts my time running this from 7.87 seconds to 6.89 -- Not the largest cut, 14% faster, but it's still a noticeable cut for a simple function where the most amount of time is generating random numbers, and it's consistently at least faster for any loop I tested that runs for a nonzero amount of time -- Of course, nonzero meaning, this is probably slower if a procedure doesn't use loops.
One other thing to (optionally, but probably) do is be to find what total variables any given procedure uses, specifically what that procedure itself calls (terminating the optimization if there's any recursion with the initial procedure), and optimize out any variables that aren't ever part of said list -- Attempting to optimize them out in these cases, with reading and setting before and after each function call respectively, turns out slower from my tests, meaning the current method is simply favorable when a called function uses said variables. Either way, this should be possible in a far more vast amount of projects and general scripts, and should handle the issue with function calls in general, even more so if you only take into consideration function calls used outside of loops, which adds extra setting (and possibly resetting) but likely would still end up faster thanks to only occurring once, compared to a previous loop which uses these variables multiple times -- This scenario of a loop before a function call outside of the loop is likely a bit obscure, but it's still probably out there in a few projects.
This detection also helps with issue 36, when Warp Timer is disabled, as you don't have to forget any variable types that aren't going to be modified by function calls, which applies even when a procedure doesn't have loops (and therefore the other optimizations here don't apply).
Finally, this could be done with Warp Timer enabled, if you set all variables to their current local values before each yield, and as previously mentioned, forget variable types after each call and at the beginning of each loop (which is to be expected anyways) -- As JavaScript runs many, many loops before said yields, it should always still be far faster to do this with Warp Timer enabled than not to.
The text was updated successfully, but these errors were encountered:
While a bit strange, and while it doesn't affect everything, this seems to end up being faster for the most mundane of tests I've performed.
Some example code I've tested goes as follows:
being transformed into
This cuts my time running this from 7.87 seconds to 6.89 -- Not the largest cut, 14% faster, but it's still a noticeable cut for a simple function where the most amount of time is generating random numbers, and it's consistently at least faster for any loop I tested that runs for a nonzero amount of time -- Of course, nonzero meaning, this is probably slower if a procedure doesn't use loops.
One other thing to (optionally, but probably) do is be to find what total variables any given procedure uses, specifically what that procedure itself calls (terminating the optimization if there's any recursion with the initial procedure), and optimize out any variables that aren't ever part of said list -- Attempting to optimize them out in these cases, with reading and setting before and after each function call respectively, turns out slower from my tests, meaning the current method is simply favorable when a called function uses said variables. Either way, this should be possible in a far more vast amount of projects and general scripts, and should handle the issue with function calls in general, even more so if you only take into consideration function calls used outside of loops, which adds extra setting (and possibly resetting) but likely would still end up faster thanks to only occurring once, compared to a previous loop which uses these variables multiple times -- This scenario of a loop before a function call outside of the loop is likely a bit obscure, but it's still probably out there in a few projects.
This detection also helps with issue 36, when Warp Timer is disabled, as you don't have to forget any variable types that aren't going to be modified by function calls, which applies even when a procedure doesn't have loops (and therefore the other optimizations here don't apply).
Finally, this could be done with Warp Timer enabled, if you set all variables to their current local values before each yield, and as previously mentioned, forget variable types after each call and at the beginning of each loop (which is to be expected anyways) -- As JavaScript runs many, many loops before said yields, it should always still be far faster to do this with Warp Timer enabled than not to.
The text was updated successfully, but these errors were encountered: