Repository navigation
docs(streaming): measure the streaming walks against the legacy reader per release band (#205) - #343
Merged
Merged
Conversation
) R2004ObjectWalker is the whole-file walker with AcDb:AcDbObjects framed into records in section order: each record's MS, R2010 MC, payload, CRC, type and handle, with fixed state and a self-contained checkpoint. The payload (the bytes the legacy RawObject::raw holds) is handed out as it arrives and committed by an Object step after the CRC, type and handle checks. Records come out in stream order with the handle they carry; the AcDb:Handles map is not read and nothing is indexed. The walker refuses an object page the page map lists out of order or a hole (ObjectsOrder) rather than keep an index; every pinned drawing lists them in order. Measured on the 28 pinned R2004-family drawings (8,007 records): the records tile the section exactly after the 4-byte 0x0DCA prologue, every record's CRC (seed 0xC0C1, MS through the last payload byte, MC included) verifies, and every MC is at most 8 times the payload; three other CRC readings agree with none (ARCHITECTURE.md 7v). The legacy walker never checked the CRC. Running the R13 to R2000 walk on two 1.3 MB drawings found that it refused an object map chunk over 2,032 bytes. A chunk's size counts its own two bytes, so AutoCAD's full chunk is 2,034 (2,033 and 2,034 in sample_AC1014.dwg and sample_AC1015.dwg); the walk failed on both with MapChunk. The limit is 2,034 now and both drawings are in verify_walk.py (1,242 and 1,047 records equal to the legacy reader's). R2004ObjectCheckpoint (DWGO, about 100 KB) holds the file walker's checkpoint, the object section's id, the framer's cursors and the section bytes not yet framed; restore requires a reachable state (the framer's CRC is recomputed where its bytes are held, its MC re-read, the section checked against the table and the unframed bytes against the section walker's cursor). The wasm kernel gains run_objects and resume_objects. verify_objects.py: every printed line equals an independent Python framing of the independently assembled section, the AcDb:Handles map and the legacy reader, on the four fixtures and the 28 drawings; fixed and proptest chunk schedules; real object sections repacked at page sizes from 4 bytes and with other sections' pages interleaved; fresh-process resume at 1,374 stops including every framer stage and an MS and an MC split across pages; bit flips, truncations and 118 resealed forgeries of checkpoints; 47 corrupt object sections each ending in its named error with exactly the records before it. verify_wasm_objects.py restores native checkpoints in the wasm32 kernel and the kernel's own in the native build, byte-identical in 611 of 611. Both run in the Streaming E2E job (timeout 30 minutes).
…etic and reject an MC of 2^64 (#205) A forged but CRC-valid DWGO checkpoint could overflow u8 arithmetic in the framer's reachable-state check (words 1 with a field length of 255) or reach positions near u64::MAX, and an MC whose tenth byte held more than one payload bit decoded to a small value because the shift dropped it. The check now bounds every field before it computes with it, the stream length is bounded at 2^62 (more is CounterOverflow), the wrapper checks the framer first, and an MC of 2^64 or more is RecordHeader, both when read and when re-read from a checkpoint. verify_objects.py forges each case (158 resealed forgeries now) and corrupts a real record's MC to 2^64 (49 corrupt sections).
…r per release band (#205) examples/stream_throughput.rs times the whole streaming walk (FlatWalker for R13 to R2000, R2004ObjectWalker for the R2004 family) against the legacy reader on in-memory copies of the six ACadSharp drawings, best of 40, and fails if the two disagree on the record count. On an Apple M2 Max the walk runs at 387 and 388 MB/s on R14 and R2000 (legacy bulk copy 7,025 and 6,266 MB/s) and 156 to 203 MB/s on R2004 to R2018 (legacy decode of every section 805 to 1,012 MB/s): the fixed state, the exact demands and the verification cost a factor of 5 to 18 in memory. The README states the command, the machine, the load and what is not measured.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…is not caught by at restore (#205)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Goal 3 of #205's streaming lane: measure the streaming walks against the legacy reader per release band, write the table and the command that reproduces it into docs/streaming/README.md.
Stacked on #333. The branch contains #333's commits because the R2004 measurement uses its
R2004ObjectWalker; the merge train lands #333 first, after which this PR's diff is one example and one README section (mergemainin, no rebase). No ARCHITECTURE.md section, no source change outsideexamples/.What changed
examples/stream_throughput.rs: reads each drawing into memory, times the whole streaming walk in 256-byte reads from aSliceSource(FlatWalkerfor R13 to R2000,R2004ObjectWalkerfor the R2004 family) againstDwgFile::from_bytesplusall_objects, and for the R2004 family againstfrom_bytesplus a read of every section; fails if the walk and the legacy reader disagree on the record count. Best and median of N runs, one JSON line per file.Result (best of 40, in memory, Apple M2 Max, 2026-10-26, machine loaded)
all_objectsThe walk is 5 to 6 times slower than the legacy decode on the R2004 family and 16 to 18 times slower than the legacy bulk copy on R14 and R2000, while it verifies what the legacy reader does not (every record's CRC, every page's checksums, the page map twice) and holds a fixed state. Where its time goes has not been profiled. R2007 is measured by
stream_r2007_timingin #340.Test plan
No unit tests. The measurement tool is an example (a second run of 25 gave the same best times within 3% for the walks and 7% for the legacy reader);
cargo fmt --all -- --checkandcargo clippy --all-targets --all-features -- -D warningspass. Corpus counts do not move: nothing undersrc/changed.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. No Autodesk SDK, ODA Teigha/Drawings SDK or GPL DWG implementation source was consulted or imported. My contribution is based on timing this crate's own readers on the pinned public drawings; no algorithm-description comments from other projects were read.