Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Script slower at each run

New Here ,
Oct 22, 2019 Oct 22, 2019

Hello!

 

I have a data exporter script, that reads all the info I need from my project and export that to an external JSON file.
My project is quite big and every time I run my script it takes more time to finish than the time before, even if I didn't had anything new, a minor change of color or something else is enough. It starts taken 9sec and after a few runs it takes some minutes, which is so boring!

 

And if I close AE and open it again, it seems that something was cleared up and it is fast again, and take again 9sec to finish.

 

So, what I want to know is if there is any command that I can run on my script that produces the same result as close-open AE?

(I don't know what it does, but I guess some kind of memory/data clean, no?)

TOPICS
Expressions , Performance , Scripting
879
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 23, 2019 Oct 23, 2019

Refer to the purge and cahce cleaning commands in the edit menu.

 

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 23, 2019 Oct 23, 2019

Tried all that, none made effect 😞

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 23, 2019 Oct 23, 2019

Using the ExtendScript toolkit I can data browser, and there is a lot of stuff from javascript there, maybe it is something about it, no?

 

Screenshot 2019-10-23 at 11.42.24.png

 

Is there any way to clear that?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 23, 2019 Oct 23, 2019

Hard to tell without seeing your code, but sounds like you're creating global variables that aren't getting cleaned up on each run. Make sure all your code (especially data-heavy segments) are wrapped in a functions or IIFE statements, that way when they're done running they get cleared out of memory and don't bog stuff down. Another thing to check for is that you're closing your files after opening them.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 24, 2019 Oct 24, 2019

Yes, about closing files I'm already doing it.

About global vars, I have some, but nothing heavy, just a few strings and numbers for config.

 

But just in case, I put all my code inside an IIFE, but nothing changed, it takes several time to complete 😞

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 24, 2019 Oct 24, 2019

Are you declaring all your variables with var? If you don't they'll leak to the global scope.

 

Also, you can monitor your memory usage with Task Manager / Performance Moniter to see if your RAM is in fact making out, or if it's something else.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 31, 2019 Oct 31, 2019

Yes, I'm using var everywhere.

I monitored the memory consumption and at each time memory increases, yes.

Also, I tried to purge all memory and cache from AE menus, and in that momento memory went down but right after click back on AE window, memory values get back to where it was before the purge action.. weird, no!?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 31, 2019 Oct 31, 2019
LATEST

Strange, well there's gotta be some variable not getting cleaned up somewhere so I'd keep looking and testing sections of code. You could purge memory programmatically with executing a command ID. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines