What kind of expressions let project slow?
I know some expressions let the project in AE or Premiere Pro (mogrt) slow. Searching on internet I've found expressions like valueAtTime, sourceRectAtTime or those who eval layer index. Well, I know too that code like "if else" statament let code slow as well. I would like to know if is that all true and if possible, to know what kind of code/expressions would be interesting to avoid in order to keep MOGRT or even after effects projects better in performance. Thanks in advance!
jonatan Nogueira commented
Thanks a lot, Dacia! For me, this is very useful and also will help me to get better results doing my things here *-*
Its true! There are certain expressions that can really slow your mogrts down once they are in Premiere. The biggest advice I can give is to try and limit the number of times an expression has to be calculated. valueAtTime() and sourceRectAtTime() are two functions that can really slow performance down if you do not give them a specific time value. When you leave the parenthesis empty, you are asking for that calculation to be re-run at every frame of the composition. Usually you really only need to know the size of the text rectangle at a specific time... like after the animation. Giving the expression a specific time means that it has to only make that calculation once.
This is true for any expression really, try helping After Effects so it has to calculate something only once.
A few more tips from one of our awesome Expressions Wizard in the AE community:
"1. Store the variable in a slider (or point), especially when you need the value on more places you can just reference to this slider; make sure to use valueAtTime(0) when referencing the slider.
2. Try to use extra sliders so you can reuse variables among script; so After Effects does not have to do the same calculation in each property again and again"
Here is a link to a git Repsitory with a ton of cool functions and instructions for how to use them so you don't have to learn how to build one from scratch right away :)
I hope this info was helpful!