Skip to content

docs(streaming): record where the streaming walks' time went (#205) - #367

Merged
DrunkOnJava merged 2 commits into
mainfrom
docs/stream-throughput-profile
Oct 27, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
docs/stream-throughput-profile

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Records the profile the streaming walks never had. They were 5 to 18 times slower than the legacy reader and "where the walk's time goes ... has not been profiled" was written in this README. The new Throughput section has the method (Instruments' Time Profiler on release builds with line tables, xctrace export, samples aggregated by function and by source line through atos -i), each finding with the pull request that fixed it (#360, #362, #364, #365, #366), the before and after of the five together on the same harness, two attempts that were measured and dropped, and what is left and why.

Before (origin/main at a315f04) to after (that tree plus #360, #362, #364, #365, #366), best of 40 (15 for R2007), Apple M2 Max under load:

Release Before After
R14 sample_AC1014 3.27 ms, 401 MB/s 0.79 ms, 1,661 MB/s x4.14
R2000 sample_AC1015 3.27 ms, 397 MB/s 0.77 ms, 1,685 MB/s x4.25
R2004 sample_AC1018 5.72 ms, 192 MB/s 2.41 ms, 455 MB/s x2.37
R2010 sample_AC1024 7.01 ms, 160 MB/s 2.99 ms, 375 MB/s x2.34
R2013 sample_AC1027 5.45 ms, 200 MB/s 2.34 ms, 467 MB/s x2.33
R2018 sample_AC1032 5.44 ms, 199 MB/s 2.34 ms, 462 MB/s x2.32
R2007 sample_AC1021 20.24 ms, 53 MB/s 7.95 ms, 134 MB/s x2.55

What is left (profile of the five together, R2010): the LZ77 decoder is 45% of samples, about 0.8 ns per output byte, comparable to the legacy reader's whole read of every section, so it is not the gap; the record CRC (17%) and the page checksum (about 9%) are checks the legacy reader does not make; the walkers' per-step plumbing is about 13%. On R2007 the syndromes (17.8%), the LZ decoder (16.9%) and SliceSource::poll_gather (13%, a transport cost) lead. Two attempts are recorded as dropped: slice copies in the LZ77 decoder (1 to 2%, within noise: copies are three to fourteen bytes) and a weighted-sum form of the checksum (0.63x of the loop it replaces).

examples/stream_throughput.rs gains --streaming-only, which skips the legacy reader so a sampling profiler sees only the walk. No library code changes.

This describes the five speedups merged: it should land after #360, #362, #364, #365 and #366.

Spec reference

Documentation and a harness flag only; no format finding and no coverage-state change. Part of #205.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
  • python3 tools/streaming/check_invariants.py, python3 tools/maintainer/train/arch.py check
  • The new flag run on sample_AC1024.dwg and sample_AC1015.dwg (stream_throughput <file> --runs 3 --streaming-only prints one line per file with no legacy columns, and without the flag the output is unchanged). No library or test change, so cargo test and the streaming verifiers are not affected by this PR.
  • Every number in the README is from the harnesses in this repository on the pinned corpus; the profile method is in the README so it can be repeated.

Source-provenance declaration

By submitting this PR I certify that my contribution does not incorporate executable code from any source whose license is incompatible with Apache-2.0. Specifically:

  • No Autodesk DWG SDK source (RealDWG, ObjectARX, ObjectDBX) or NDA-protected Autodesk documentation was consulted or imported.
  • No Open Design Alliance Teigha / Drawings SDK source was consulted or imported. The ODA's public Open Design Specification for .dwg files PDF is explicitly allowed (see CLEANROOM.md).
  • No GPL-licensed DWG implementation source (LibreDWG, etc.) was consulted or imported. This matters because dwg-rs is Apache-2.0 and must remain compatible.

My contribution is based on:

  • The ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1);
  • Public reverse-engineering notes, research papers, or blog posts cited inline;
  • Reading algorithm-description comments (not executable code) in permissively-licensed projects (MIT / Apache / BSD) to resolve spec ambiguities — disclose any such reading in this PR body so it can be recorded in CLEANROOM.md.

See CLEANROOM.md for the full allowed/forbidden source list and the honest scope of what "clean-room" means for this project.

Developer Certificate of Origin

By submitting this PR, I certify that the contribution complies with the
Developer Certificate of Origin 1.1.
Specifically, I affirm that the contribution is my own work (or rightfully
licensed to me) and that it can be distributed under the project's Apache-2.0
license.

I will sign off commits with git commit -s when asked, which adds a
Signed-off-by trailer to the commit message asserting the DCO.

The streaming walks were 5 to 18 times slower than the legacy reader and
nobody had profiled why. This records the profile (Instruments' Time Profiler
on release builds with line tables, samples aggregated by function and by
source line through atos), what each finding was and which pull request fixed
it, the before and after of the five changes together (R14 and R2000 about
4.2x, R2004 to R2018 about 2.3x, R2007 2.55x), two attempts measured and
dropped, and what is left and why: the LZ77 decoder, the checks the legacy
reader does not make, the walkers' per-step plumbing and, on R2007, the
syndromes and the slice source's per-byte gather.

stream_throughput gains --streaming-only, which skips the legacy reader so a
sampling profiler sees only the walk.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T07:59:13.752201Z b949f4f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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