expression sampling interval
After Effects evaluates an expression at various times to determine whether the values held in the global performance cache are current or are stale and need to be updated with fresh values. This sampling at various times along the composition can cause interactions in a composition that combines expressions and certain other features to be rather slow, which causes various interactions to be sluggish.
You can force the number of samples for a given expression to be exactly 1 for the entire composition by inserting the following comment in the expression:
// cacheCompareSamplesPerSecond 0
Even without the addition of this comment, After Effects will only use one sample for the entire composition if there are no features used that span across multiple frames, such as motion blur or wide-time effects (e.g., the Echo effect).
The risk of using this feature to specify that only one sample is used is that you may get stale values in the global performance cache. Only use this comment when you are experiencing slowdowns with expression evaluation; be sure to check your rendered frames to make sure that they are updating as they should.
You can also use the same comment with a whole number value to specify a sampling rate with the units of samples per second. For example, the following comment forces the expression to be sampled 25 times per second – i.e., on every frame of a 25fps composition:
// cacheCompareSamplesPerSecond 25
You should very rarely need to specify a higher sampling rate than the default, since After Effects will by default use an adaptive sampling rate that should be appropriate for most cases. Only set a higher sampling rate if you find that the frames that you are seeing contain the wrong image information that is not updating when it should. Specifying a high sample rate will slow down expression evaluation, so it should only be used when a problem is actually observed. You are only likely to run into this problem if the expression is upstream from a temporal effect such as Echo or Roto Brush or an extreme time speedup, or has very high frequencies and is motion blurred.