You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0d7232a
Browse filesBrowse the repository at this point in the historyBrowse files
perf(editor): convert in a worker, so x2t's heap can be handed back
Every conversion -- convertToBin on open, convertFromBin on save -- now
runs in a dedicated worker. Guard 14 replaces those two methods on
AscCommon.x2t with a proxy; x2t.worker.js loads the same x2t_helper.js
and drives it. The worker is created on demand and terminated after 30 s
idle, so the ~340 MB x2t heap is handed back for the editing session
instead of staying resident for the life of the editor frame (x2t.js is
an unwrapped classic script, so wasmMemory/HEAPU8 are frame globals and
destroy() only clears a JS reference).
Not a fix for #144: the open-time peak is unchanged, and a dedicated
worker shares its document's renderer process. The win is lifecycle, plus
conversion no longer blocking the frame's main thread.
x2t_helper.js is loaded in both places and branches on `typeof document`
at three sites rather than being reimplemented worker-side -- format
codes, the doc/xls/ppt two-step, the PDF-changes merge and exit-code
classification stay in one file, pinned by vendor-contract.
Fonts cross as a list, not as bytes: a one-paragraph Latin document needs
14 files and 4.6 MB, a CJK PDF export 16 and 25.4 MB, per conversion. The
worker fetches the same URLs off the same cache.
Three things broke on the way, all now fixed and written down:
transferring the request buffers detached the editor's live Editor.bin;
`instanceof` is false across realms, which broke the PDF editor (it
passes bytes, not a blob URL); and collecting the font list inherited
guard 3's race without its TypeError, i.e. a silent fontless import
(#146) instead of a retryable -82.
Reverse-validated: with the guard disabled, wasm-memory.spec.ts fails --
no x2t worker is ever created.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MKNHFQ1kek1cHeqhbH37Pk
0 commit comments