Skip to content

Reduce DOC conversion allocations and native cache contention - #34

Merged
andrewlu0 merged 4 commits into
mainfrom
andrew/doc-parser-performance
Nov 3, 2026
Merged

andrewlu0 merged 4 commits into
mainfrom
andrew/doc-parser-performance

Conversation

@andrewlu0

@andrewlu0 andrewlu0 commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Legacy Word import copied container streams and image payloads, repeatedly decoded text, and scanned formatting runs for each paragraph. Move owned streams/assets, reuse UTF-16 and formatting data, index overlapping runs, and append XML directly while preserving the generated package and parsed output.

Native cache hits now read immutable snapshots, with a thread-local regex reader. One actor owns cache updates through an eight-slot mailbox; optional cache admission is skipped when full, while parsing still returns the complete result. Regex registration acknowledges publication. WebAssembly retains its existing single-threaded cache path.

Validation:

  • 329 existing Rust tests passed; one opt-in corpus test ignored.
  • WASM target check passed; package build passed for the DOC changes, and the optimized WASM artifact is included.
  • Allocation-only build: all 5,316 accuracy records unchanged across 1,329 inputs; full model/block parity confirmed, including reproducing six existing source-ID variants with the original binary.
  • Final cache build: 1,088 concurrent parses across 272 inputs at four and eight callers match sequential content and structure, normalizing existing document-ID variability and unordered style definitions.
  • Final four-library rerun completed on all 1,329 inputs: all 5,316 accuracy records unchanged; strict model/block output parity confirmed against the original binary, including six reproduced source-ID variants.
  • Paired baseline/candidate timing: DOC median per-input latency improves 6.6%, with 11.0% lower cohort p95. DOCX is effectively unchanged. DOC opening improves 23.4% and XML construction 11.3% in the detailed stage profile.
  • Updated docx-core README includes all format charts and sanitized measurements. Concurrent cache gains remain workload-dependent; synchronous actor writes and a parallel-admission gate were rejected.

@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
react-docx-playground Ready Ready Preview Nov 3, 2026 1:27am UTC

Request Review

@andrewlu0
andrewlu0 merged commit eaf0f26 into main Nov 3, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — f787c474 Deployed Nov 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant