Simon,
I've been posting versions of a patch to integration.js to the Zotero
tracker on GitHub. Working with a user's large document as a test
case, we have brought the time required to refresh citations down from
about 8 minutes to about 25 seconds. For the test document, a nearly a
20-fold speed increase. The system also scales better, as the time
required for document processing is now directly proportional to the
number of citations, rather than extending geometrically.
https://github.com/zotero/zotero/issues/134
The approach is to add citations to the processor registry in one go,
using updateItems(), and then to rely on the processor's persistent
registry and tainting logic to identify citations that require an
update, and write only those fields back into the document. The patch
linked from the tracker thread is now in pretty good shape, as far as
I can tell. Unfortunately, we're getting some weird behavior that I
can't explain from the code in integration.js. I think it might be a
problem with the plugin, but I'm not sure.
I've tested in MLZ, using code from which the patch posted to the
thread is derived. Attempting to insert a citation in the document
after opening hangs the processor, with the final message:
zotero(3): ZoteroOpenOfficeIntegration: Performing asynchronous read
zotero(3): Reading from stream
zotero(3): ZoteroOpenOfficeIntegration: Reading 1853189228 bytes from
stream
I can avoid the error by setting dom.max_chrome_script_run_time to 0
to disable timeouts, or by setting it to a large value. I have seen
hangs very occasionally with this adjustment, but they do become
uncommon.
The value of dom.max_chrome_script_run_time must be set to 0 (or a
large value) at Firefox startup. As you can see in the patch, I'm
attempting to disable timeouts on the fly, but that has no effect; the
hang at a faulty attempt at a 1.8 gig read during the first citation
insert attempt still occurs consistently.
I have tested with two configurations (and combinations of the two) in
an attempt to isolate the problem. The only thing I haven't varied is
the LibreOffice Integration plugin. The failure is consistent in all
configurations, which leads me to wonder whether the greater speed of
transactions (?) might be causing the plugin to fall over. Either
that, or I've missed something in my adjustments to the code in
integration.js (?). Here are the configurations that I have tested
with, on an Ubuntu 12.04 system:
Firefox 12.0 (Canonical build)
java-1.6.0-openjdk-i386 (Ubuntu)
LibreOffice 3.5.3.2 (Ubuntu)
LibreOffice 3.5.4.2
java-7-oracle
Firefox 13.0 (Firefox build)
I hope you can help with this. I'd really like to land these changes
in official Zotero if possible. The speed improvement is dramatic
enough to be noticeable to anyone working on a project that grows to
thesis length (unless Word is blistering fast in ways that LibreOffice
is not).
Frank