mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-10 13:01:29 +00:00
On a large dynamic XFA form, every script of an event copied the whole form twice before it ran (the engine's live form to the script engine's tree, then that tree to the flattened form the host works on), and every resetData call rewrote and rescanned the whole document. On a 1,300-script form opening spent its 3 s budget on these copies and on twenty resets, and skipped the last 850 initialize and calculate scripts. The engine now sends the scripts of an event one shared tree (Arc) until the live form changes in any way, and the script thread keeps the flattened form it built from that tree; each script starts from a copy whose text is shared (Arc<str>), so it costs a fraction of a flatten. Each script still gets its own copy: nothing one script changes reaches the next except through the engine. Resets in a row in one script's effects are applied as one reset of the names together. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CBVyQEwtmEw3mS1MoAiwrK