954 Messages
•
15.3K Points
How to maximize script performance?
I have script which will create cca 500 layers
I would like to speed up this task as much as possible.
My question is... if I change some settings, can script run faster?
My ideas:
1) minimize app to taskbar
2) hide panels
3) set canvas size to 1x1 px
4) turn off layers thumbnails
5) hide navigator panel
6) some cache tiles changes
7) freezing history states - merging many history states into one
Anything else?
I would like to speed up this task as much as possible.
My question is... if I change some settings, can script run faster?
My ideas:
1) minimize app to taskbar
2) hide panels
3) set canvas size to 1x1 px
4) turn off layers thumbnails
5) hide navigator panel
6) some cache tiles changes
7) freezing history states - merging many history states into one
Anything else?
Responses
max_johnson_7790531
Champion
•
626 Messages
•
14.6K Points
4 y ago
I haven't tried optimizing speed other than using AM commands as much as possible in lieu of the JS apis.
Please post back any of your findings!
2
0
naoki_hada
3 Messages
•
88 Points
4 y ago
there's suspendHistory().
2
0
jaroslav_bereza
954 Messages
•
15.3K Points
4 y ago
3
0
jaroslav_bereza
954 Messages
•
15.3K Points
3 y ago
Example.
Note: you need to have 200+ layers in document.
4
0
jaroslav_bereza
954 Messages
•
15.3K Points
3 y ago
I have document with ~ 1200 layers (452 layers and 372 groups which have start and end layer so it counts as two)
With command: var lyr = app.activeDocument.layerSets[0];
It runs 3x get descriptor command for each layer + some additional commands.
It gets: layerSectionType, name, layerID
It means 3600 get descriptor commands + few extra.
And with var lyr = app.activeDocument.layerSets[0].layerSets[0] it means 7200 commands + few extra commands in addition to extra commands. So nesting inside layersets might be very costly.
It makes tree structure from linear structure and everytime it check every layer in document.
With AM code you can traverse all layers only once.
1
0