Try to disable "Preflight". That helped me with scripts which created a lot of hyperlinks: 10,000+ per document.
First, thanks for the response.
It does seem like turning preflight off in the UI-based InDesign (Window – Output - Preflight) does get an IDML with almost 10,000 hyperlinks to open a bit faster. I don’t, however, see the same open file performance improvement for the UI-less InDesign Server (app.preflightOptions.preflightOff = true;) which is the real issue for us. That might not be surprising though as I think though that preflight might be off by default in InDesign Server. In the ExtendScript Toolkit the Data Browser even shows “preflightOff = true”.
I should have mentioned that, to also attempt to speed up open times, the following are unchecked in ID…
[ ] Check Links Before Opening Document
[ ] Find Missing Links Before Opening Document
…which should correspond to setting the following to false in a *.jsx script with IDS…
app.linkingPreferences.checkLinksAtOpen = false;
app.linkingPreferences.findMissingLinksAtOpen = false;
While it "only" takes about 2 minutes to open a 2MB, 182 page IDML file with all of those hyperlinks and no embedded images in ID, that same file takes about 40 minutes to open in IDS.
Are these hyperlinks in some way linking to another InDesign document?
Nope. They just point to fictitious URLs. It's purely for bookmarking purposes.
I see all kinds of process activity for the active InDesignServer.exe (there are four such EXEs on this quad-core host) during the 40 minutes it takes to open the file in question so InDesign Server is doing something. The question though is what is it doing.
Since the console output for InDesign Server shows the log4-like INFO, WARN etc. messages, it would seem that DEBUG logging could maybe be configured to see what activity is going on.
On a Mac you either use the Activity Monitor or the Instruments application (part of the Xcode IDE) for various performance analysis down to the system calls (dtrace) and their invocation stack frames. I assume Windows provides similar tools, or you might just reproduce your problem on a spare Mac with a trial or developer license.
Let me see - yup, the technology exists on Windows - Trace Provider
Btw, InDesign (Server and Desktop) has separate "debug" builds for plugin developers with plenty internal consistency checks "assert" and debug output. For speed reasons these are stripped out from release builds, it might be worth a try if you have access to those builds. Of course they will take even longer... The above mentioned analysis via the OS may also benefit from more symbols on such development versions.
InDesign Server (even release build) also has some performance metrics available via scripting (somewhere on the app object), have you tried these?
On the other hand it could also be something unrelated - do you have any extra software (plugin, startup scripts, scripted event handlers) that could interfere? E.g. a link event handler that waits for a timeout on every $.write without connected ESTK? On one client's InDesign server farm I reduced restart times down from minutes to barely noticable just by optimizations of the startup process, before I tracked down and eliminated the bugs (in the SOAP interface and in XPath) that caused all those crashes ;-) . Of course such problems are beyond the scope of a forum, they take several days to analyze and solve, especially if they require changes of the binaries from Adobe.
I would just add that if you're getting this issue also with the regular
version of InDesign, then it's not really a scripting question. For your
own advantage, you may want to consider re-asking this in the regular
InDesign forum -- you might get some more help there. I do recall
similar questions being asked.
There is also a forum dedicated to InDesign Server, as this appears to be a server specific problem (2 min vs. 40 min) ...
Btw, one other idea comes to mind: are all the required fonts installed on the server?
When you're opening an IDML-file, the InDesign document is created anew and hyperlinks are created anew too. At the beginning creating a hyperlink takes about 0.1 second, but if the document already contains, say, 20,000+ hyperlinks, it may take about 1,5—2 minutes to make only one hyperlink (no difference whether you create it by script or manually in InDesign). That's the way InDesign works and we can nothing to do with this (in my opinion).
The OP reported serious differences between InDesign Desktop (2 minutes) vs. InDesign Server (40 minutes) on the same file.
IMO InDesign Server should always be faster.
I'd probably open a support ticket for this and send the file to Adobe. Let them figure out what's wrong with IDS...
I was in touch with Adobe Support and after providing details and sample files it seems they agree there is a bug regarding the slow file open times for IDML files with hyperlinks:
Thanks for sharing the file and detailed information.
As per our knowledge there is no known issue wherein delay should happen because of large number of Hyperlinks however I was able to reproduce the issue.
It seems to be the bug with InDesign and InDesign Server, as it is independent of system and InDesign settings.
I will log the bug for this issue and share the details with product engineering team. They will look into this and will try find out the reason for slow performance.
Though it is a crucial issue, I cannot confirm any ETA for a fix or workaround but will keep you posted on the action taken.
In case I find any workaround then will share it with you as soon as possible.
Also, Will share the bug number on Monday.