Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How fast are variables?
- shmuel3
-
6 posts
How fast are variables?
I run into this predicament a lot where I have a loop that takes in an input value, does some operation on that value, and it uses that value every loop cycle. the problem is: do I calculate it once, at the beginning, then store it in a variable to prevent it from doing the calculation every cycle, at the expense of keeping track of another temporary variable? Or do I just do the calculation every loop cycle. Thoughts?
- -EmeraldThunder-
-
1000+ posts
How fast are variables?
I would say that it is better to store the calculation in the variable. Especially if it is a long one or involves trigonometric functions.
- deck26
-
1000+ posts
How fast are variables?
It's generally going to be more efficient to calculate something once rather than every time through a loop. Keeping track of variables shouldn't be an issue.
- henryforlove
-
1 post
How fast are variables?
How much days weeks or months will it take for the scratch cloud variables to work again
- Discussion Forums
- » Help with Scripts
-
» How fast are variables?