Skip to main content
Known Participant
September 22, 2014
Answered

What are some common performance tips for ExtendScript?

  • September 22, 2014
  • 1 reply
  • 387 views

Are there any common tips (read: design patterns) that would help the performance of a long-running script? I mean, without a specific case, some general tips.

For example, when looping over layers, it's better not to query the number of layers at each iteration.

That is,

for (var i = 0, len = set.layers.length; i < len; i++) { .... }

is faster than

for (var i = 0; i < set.layers.length; i++) { ... }

That's a simple optimization off the top of my head.

This topic has been closed for replies.
Correct answer c.pfaffenbichler

Using Action Manager code where it’s feasible can be beneficial (DOM is often slower).

Hiding Panels that may update during operations (Layers, Channels, Histogram for example) might also be a factor.

Making sure Playback Options is set to Accelerated.

Functions for repeatedly called operations.

1 reply

c.pfaffenbichler
Community Expert
c.pfaffenbichlerCommunity ExpertCorrect answer
Community Expert
September 22, 2014

Using Action Manager code where it’s feasible can be beneficial (DOM is often slower).

Hiding Panels that may update during operations (Layers, Channels, Histogram for example) might also be a factor.

Making sure Playback Options is set to Accelerated.

Functions for repeatedly called operations.