ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

What kind of expressions slow down comps the most?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Coen Rens
What kind of expressions slow down comps the most?
on Jan 30, 2017 at 10:51:07 am

Hi everyone,

I'm currently building a character animation 'tool' in AE to be used by a others who work on the same (line of) project(s).

As it's getting more complex it's starting to slow down, as could be expected of course, but I'd like to make a few economic cuts to speed it back up a bit for more comfortable use.

In order to do that I would be really helped to know which things typically slow down a comp the most, and especially: what kind of expressions are the heaviest and which ones are typically lighter? If I know this I can try to replace heavier expressions with lighter alternatives.

What I've gathered so far from other forum posts is that expressions that have check literally every frame / refer to previous frames are heavier. Does this make the valueAtTime expression inherently heavy?

Hope someone is willing to share some insight. :-)


Return to posts index

Coen Rens
Re: What kind of expressions slow down comps the most?
on Jan 31, 2017 at 2:38:33 pm

For instance, are expressions that 'check' other layers known to be heavier than more 'self-sustaining' expressions?

I will eventually try and do a number of tests myself, but since I'm pressed for time at the moment, any small piece of knowledge someone could share is welcome.


Return to posts index

Dan Ebberts
Re: What kind of expressions slow down comps the most?
on Jan 31, 2017 at 5:48:41 pm

In my experience, it basically boils down to how many expressions have to be evaluated (or how many times a particular expression has to be evaluated) each time your expression runs. Anything that starts at time = 0 and moves to the current time (using valueAtTime()) frame-by-frame gets more expensive as time goes on. Depending on the situation, it can be more efficient to start at the current frame and go back until you find the condition you're looking for. Another thing to watch for is cascading expressions where an expression refers to the same property in the previous layer, which has an expression referring to the same property in its previous layer, etc.

Obviously, the complexity of an expression also has an effect on its performance, especially if it is referenced in a frame-by-frame loop. A lot of the Math functions are relatively expensive.

Unfortunately, sometimes these performance penalties are impossible to avoid.

Dan



Return to posts index


Coen Rens
Re: What kind of expressions slow down comps the most?
on Feb 1, 2017 at 3:06:41 pm

Those are a few great places to start looking, Dan, thanks for the advice!

Firstly, my character rig uses a lot of Paths that use valueAtTime() linked to a Slider control to have a user 'scrub' between its keyframe values; i.e. for turning a head from left to right. As this way of using valueAtTime is referring to a relatively static Slider value, I wouldn't think that this would be the check-every-single-frame-as-time-goes-on variant that you speak of?

Secondly, my rig also uses some javascript Math and vector functions, especially Math.cos / sin / tan, and length() so the user can animate the character by moving limb controlling circles around (hand, elbow, etc), with the expression deriving the proper rotation angles for the limbs from these circles' positions. I wonder if these would benefit from replacing the Math functions with written-out varieties of them, using 3.1415 instead of Math.PI for instance, although I would assume that function to be a simple as a stored number.

Lastly, the rig uses groups within shape layers for the customization of the character's appearance (hair, clothes, etc). Some of these are set to 0% opacity when not 'selected' by the user, but I imagine After Effects will still perform the calculations they require as 0% opacity is not the same as a layer switched to invisibility...

Any thoughts on these possibly performance-lowering issues are welcome!


Return to posts index

Dan Ebberts
Re: What kind of expressions slow down comps the most?
on Feb 1, 2017 at 6:20:20 pm

> I wouldn't think that this would be the check-every-single-frame-as-time-goes-on variant that you speak of?

No.

>I wonder if these would benefit from replacing the Math functions with written-out varieties of them, using 3.1415 instead of Math.PI for instance

I don't think that would save you much

> but I imagine After Effects will still perform the calculations they require as 0% opacity is not the same as a layer switched to invisibility...

I'm not sure. I suppose you could test it, but I don't know what the alternative would be.


Dan



Return to posts index

Coen Rens
Re: What kind of expressions slow down comps the most?
on Feb 2, 2017 at 1:05:39 pm

Alright, thanks for your thoughts!

I'm performing some tests now, cutting away different things and observing how the speed improves.


Return to posts index


Coen Rens
Re: What kind of expressions slow down comps the most?
on Feb 9, 2017 at 9:43:24 am

Reporting back after testing:
(TLDR: it turns out that Shape Layers were a bigger factor in slowing it down than the expressions were)

I used FRAPS to show the framerate at which After Effects was running, to compare different versions of the character-rig composition.

I tried several changes and made notes of the framerate difference.

- all expressions combined accounted for a framerate difference of about 20 fps
- but all Shape Layers accounted for a framerate difference of about 30 fps!

My comp being a combination of those two had slowed the comp's operating speed down to a very choppy 5-10 fps...

I made a new version of the composition where I try to avoid Shape Layers and instead work with Illustrator footage layers and Masks. This improved performance a lot! It currently runs at about 30 fps.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]