Skip to main content
Known Participant
September 5, 2011
Question

Performance Issues: General Suggestions and "Gotchas" ???

  • September 5, 2011
  • 1 reply
  • 640 views

I have written a Photoshop CS5 Extension in ActionScript. "Its performance is too slow", says the man in the corner office...

I would appreciate suggestions both for what I SHOULD do to speed things up, and also what I should NOT do in order to speed things up.

The general purpose of the script is to open a few images, and place them and their clipping paths (PathItem objects) at a given location on a single target page.

My general workflow is:

<pseudocode>

Create target document

BEGIN foreach image to be copied onto the target document:

     Open image document for image

     Scale image document to match the DPI of the target document

     Copy/paste from the image document to a new layer on the target document

     Move the new layer to its desired lation via transform()

     Convert the clipping path (PathItem) data from the image document to an array and add it to a aggrregateclipping path (PathItem) - a union of all clipping paths

     Close the image document

END foreach

Create a new PathItem in the target document from the aggregate clipping path

Flatten target document

</pseudocode>

What could I do to improve this? For example, I assume that the History functinality consumes resources. Could I turn off history? Any other ideas what I could do or not do to improve performance?

TIA,

mlavie

This topic has been closed for replies.

1 reply

JJMack
Community Expert
Community Expert
September 5, 2011

Scripting is not going to be fast for it not compiled code and need to be interpedit throughout its execution and scripts like action do Photoshop type steps. To speed up a script you need to use as few photoshop steps as posible and not use photoshop things and functions that have high overhead when posible to shorten execution time.  Layers like placed Smart Objects have high overhead rasterize these to a normal layer if you process does not require these layers to be smart objects may speed up execution.  Photoshop also has a SDK you may be able to code a compiled plugin for your process.

JJMack
Inspiring
September 5, 2011

My first suggestion would be your application choice… Why Photoshop? for this which would be much better suited to a Page Layout app like InDesign… I would fully expect this to be slow done in such a manor…

mlavieAuthor
Known Participant
September 5, 2011

Thanks @JJMack and @MuppetMark!

@MuppetMark: Do you have any reason to believe that the movement of InDesign objects (rectangle with an image, etc) would move any faster in script than Layer movement in Photoshop?

mlavie