Skip to content

Speed up XML generation and update Rust to 1.93.1 - #922

Merged
bokuweb merged 1 commit into
mainfrom
codex/optimize-xml-writer
Sep 5, 2026
Merged

Speed up XML generation and update Rust to 1.93.1#922
bokuweb merged 1 commit into
mainfrom
codex/optimize-xml-writer

Conversation

@bokuweb

@bokuweb bokuweb commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • stream encoded start tags directly instead of retaining a second pending buffer
  • box EventWriter internal state so XMLBuilder ownership transfers move one pointer
  • reduce the start-element inline buffer from 128 to 64 bytes
  • update the repository Rust toolchain from 1.88 to 1.93.1

Performance

Criterion benchmarks on Apple Silicon:

Benchmark Before After Improvement
write_docx_build 1.979 ms 1.052 ms 46.8%
write_docx_build_pack 3.080 ms 1.950 ms 36.7%
write_docx_large_build_pack 25.25 ms 20.11 ms 20.3% before the final boxing optimization
write_docx_many_static_tocs 10.30 ms 7.50 ms 27.3% before the final boxing optimization

After boxing the writer state, XMLBuilder::add_child dropped from about 9.7% to about 1.0% of sampled top-of-stack frames.

Validation

  • 327 library unit tests passed
  • 62 integration tests passed
  • cargo clippy -p docx-rs --lib -- -D warnings
  • cargo fmt --all -- --check

The tests and focused final benchmarks were run with Rust 1.93.1.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

This report was generated by comparing 1899af3 with 90ea838.
If you would like to check difference, please check here.

success

ArtifactName: wasm

✨✨ That's perfect, there is no visual difference! ✨✨

item count
pass 46
change 0
new 0
delete 0

@bokuweb
bokuweb merged commit 28108b8 into main Sep 5, 2026
11 checks passed
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