Skip to main content
Participant
August 17, 2020
Answered

The execution time is very different when executing Javascript from File -> Scripts and app.doJavasc

  • August 17, 2020
  • 1 reply
  • 892 views

When you select a file from the File -> Scripts menu and run it, it runs very quickly, and there is no slowdown in running it several times in succession.
However, if you run it using app.doJavascript in VBA or run the script in CEP, it runs quickly as soon as the application is first started, but the speed continues to slow down every successive run.
I am trying to show the information of the illustrator document contents in CEP or external application, but I cannot use it because of the slower speed each time I run it. Using $.gc() didn't change anything.
Both show the same behavior in 2020 and 2019 versions. I wanted to test the previous versions as well, but they are not on the Adobe Creative Cloud installable list.
I am trying to create a CEP or an external application that shows detailed information of an illustrator document, but there is a problem because the consistent speed is not available. What is the solution?

 

 

 

This topic has been closed for replies.
Correct answer MilosR

Yeah, that's what I found too. I also tried it all wrapped in an object and that didn't help either. I'm really curious!

It seems to be getting slower linearly, but I haven't graphed the times. Closing and reopening the document doesn't help.


Could it be related to this. Looks like there are some performance issues with scripting. https://community.adobe.com/t5/illustrator/script-takes-longer-and-longer-when-accessing-individual-pathpoint-objects/m-p/10917358?page=1

1 reply

m1b
Community Expert
Community Expert
August 17, 2020

Hi, I'm not an expert at this, and your code looks fine to me, but if you have time to experiment, it might help to try structuring your script as a Self Invoking FunctionThis answer gives a quick overview.

 

The idea is to tidy up the scope of the variables, so there shouldn't be anything left in memory after the function has been executed. The second execution should leave memory as pristine as the first. Well, that's the theory.

 

EDIT: I was curious, so I just tried structuring your code as a self-invoking function and it didn't help. Each run gets slower, as you report. Curious! I'll wait for an answer, too. 🙂

Participant
August 17, 2020

I just modified and tested it, but nothing changed.

m1b
Community Expert
Community Expert
August 17, 2020

Yeah, that's what I found too. I also tried it all wrapped in an object and that didn't help either. I'm really curious!

It seems to be getting slower linearly, but I haven't graphed the times. Closing and reopening the document doesn't help.