Repository navigation
perf(streaming): slice the R2007 CRC-64s, checksum and syndromes (#205) - #366
Merged
Merged
Conversation
Three checks of the R2007 walk ran a byte at a time: the two CRC-64s (§5.12, 8-byte blocks taken as 6 7 4 5 2 3 0 1) behind a copy into a block buffer, the §5.4.1 page checksum, and the Reed-Solomon syndromes (a log and exp lookup and a zero test per syndrome per byte). In the Time Profiler profile of the streaming R2007 walk of sample_AC1021 they were about 12% (checksum), 10% (CRC-64) and 13% (syndromes) of the samples. Whole blocks now go straight from the slice: the CRC-64s fold eight bytes per step with slicing tables built at compile time (the permuted block as one word); the checksum adds eight lanes of its recurrence vertically in the block order and combines them once per slice, with the reduction at the same 0x15B0-byte boundaries; the syndromes use a multiplication table per root, one lookup per byte per syndrome. A scratch differential check against the old code (not committed) compared 728,266 cases: both CRC-64 flavours' state and the checksum's state after every update of random slices, and the whole syndrome vector of 40,000 random words for both codes. Checkpoints are unchanged. R2007 streaming walk, best of 15 in memory (examples/stream_r2007_timing), against origin/main, Apple M2 Max under load: sample_AC1021 20.63 ms -> 12.85 ms (x1.61; 51.5 -> 82.7 MB/s of the file)
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. |
5 tasks done
DrunkOnJava
enabled auto-merge (squash)
October 27, 2026 07:33
DrunkOnJava
added a commit
that referenced
this pull request
Oct 28, 2026
… to what landed (#205, #206, #207) (#400) The ledger stopped at the header and the R13-R2000 walk, and the README's checkpoint contract described the header checkpoint alone and said full object and decompression checkpoints remain open. Both now cover the ten checkpoint kinds on main and the walkers of #240, #246, #260, #276, #299, #312, #333, #340 and #363, the perf series #360 to #366, and cite the evidence files of Streaming E2E run 40532346151. What was not measured is marked NOT MEASURED.
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
Three checks of the R2007 walk ran a byte at a time. Now: the two CRC-64s (§5.12; 8-byte blocks taken as 6 7 4 5 2 3 0 1) take whole blocks straight from the slice and fold eight bytes per step with slicing tables built at compile time; the §5.4.1 page checksum adds eight lanes of its recurrence vertically in the block order and combines them once per slice, reducing at the same 0x15B0-byte boundaries; the Reed-Solomon syndromes (§5.13) use one multiplication-table lookup per byte per syndrome instead of a log, an exp and a zero test. Checkpoints are unchanged.
Profile (Time Profiler, the streaming R2007 walk of
sample_AC1021.dwgalone): the checksum was 14.6% of the samples, the CRC-64s 12.3%, the syndromes 10.3% (6.2% more in their iterator).A scratch differential check against the old code (not committed) compared 728,266 cases: both CRC-64 flavours' state and the checksum's state after every update of random slices (seeds, lengths and slicings random, across the 0x15B0 reductions), and the whole syndrome vector of 40,000 random words for both codes.
R2007 streaming walk, best of 15 in memory (
examples/stream_r2007_timing, Apple M2 Max under load), againstorigin/mainata315f04:sample_AC1021(1.06 MB)Together with the sibling copy-table PR the R2007 walk goes from 20.24 ms to 7.95 ms (x2.55), measured on the two merged.
Spec reference
§5.12 (the CRC-64s), §5.4.1 (the checksum), §5.13 (the Reed-Solomon codes), unchanged in meaning. Performance only: part of #205. No format finding, no coverage-state change.
Test plan
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-featurescargo +1.85 check --all-features(MSRV)cargo test --release --all-features(existing suites only; no test added; built without LTO to fit the machine's CPU budget, perf(streaming): fold eight bytes per step in the DWG CRC-8 (#205) #360 ran the full LTO profile)python3 tools/streaming/check_invariants.py;tools/streaming/no_std.rscompiled natively and forwasm32-unknown-unknown, state bounds holdverify_r2007.py(the 8 pinned drawings and the files it builds, including a non-zero CRC seed, stored and compressed system pages and a page of 273 codewords: every output line and section byte equal to the independent Python reader and the legacy reader; its corruptions each end in the namedR2007Parity,R2007Crc64orR2007Checksum) andverify_wasm_r2007.py(native and wasm32 checkpoints byte-identical). Both passed; each writes its binary SHA to its evidence JSON.cargo build --release --example stream_r2007_timing, thentarget/release/examples/stream_r2007_timing <corpus>/acadsharp/sample_AC1021.dwg 15, build oforigin/mainagainst build of this branch, alternated.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:
CLEANROOM.md).dwg-rsis Apache-2.0 and must remain compatible.My contribution is based on:
CLEANROOM.md.See
CLEANROOM.mdfor 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 -swhen asked, which adds aSigned-off-bytrailer to the commit message asserting the DCO.