Copy link to clipboard
Copied
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?
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
Copy link to clipboard
Copied
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 Function. This 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. 🙂
Copy link to clipboard
Copied
I just modified and tested it, but nothing changed.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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-...
Copy link to clipboard
Copied
Yes! Thank you MilosR.
kyoung_namk48754987, please look at the difference between the OPs script and CarlosCantos' below. Amazing difference in performance!