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

javascript caching

New Here ,
May 18, 2010 May 18, 2010

Hello guys,

in our IDS implementation we are using lots of javascript functions. This functions are defined within 2 files, one of them contains about 2000 rows. The problem is, that the include of this file with the

#include...

statement takes about 80 ms. This is a long time, especially when you know, that this file only defines methods, nothing is executed at the time of inclusion. Now my question is whether there is a possibility to tell the server to persistently keep this functions in memory with no need to include the file on every request (we are using soap for communication). Maybe there are some tricks to make the IDS JavaScript parser more performant?

Thanks in advance!

    Peter

1.1K
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 ,
May 18, 2010 May 18, 2010

If you use a persistent engine, you can load all your functions once per session, and it will be available in memory to all scripts running in the same engine.

Harbs

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 ,
May 18, 2010 May 18, 2010

what do I have to do to run a "persistent engine"?

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
Mentor ,
May 22, 2010 May 22, 2010

See JavaScript Tools Guide CS4.pdf, page 228

#targetengine enginename

Defines the target JavaScript engine for this JSX file, within the designated target application. Supported by Adobe Illustrator CS4 and Adobe InDesign CS4; other applications ignore the directive.

For Adobe Illustrator CS4 and Adobe InDesign CS4, if the named engine does not exist, and if the script originates within the application (rather than being executed in the ExtendScript Toolkit or received in an interapplication message), the application creates a new JavaScript engine with this name, which persists for the lifetime of the application session.

If the script originates outside the application, and the named engine does not exist, the directive is ignored.

Dirk

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 ,
May 22, 2010 May 22, 2010

thank you guys, now the javascript files are included only once instead of being included on every request to the server, this makes the whole application more responsive.

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
Mentor ,
May 23, 2010 May 23, 2010
LATEST

I just reminded myself this is the server forum.

Some additions:

To create a new session e.g. for InDesign desktop / ESTK to try things out, use a startup script.

You should also thoroughly test your scripts against leaks - some constructions are not caught by the garbage collector.

As preparation install your script and do a test run.

Then invoke the garbage collection yourself. Do it twice, it really makes a difference.

my_testscript();

$.gc(); $.gc();

$.writeln($.summary());

Repeat the exercise a couple of times, and see whether there are changes in the summary.

Dependent on the amount, you better track them down or plan to restart the server every now and then.

Dirk

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