Repository navigation
perf(streaming): copy a record's first bytes as a slice (#205) - #364
Merged
Merged
Conversation
The object framer kept the first 32 payload bytes of each record (to read its type and handle from) with a per-byte function that bumped the count. In the Time Profiler line profile of the streaming R2010 walk (after the CRC-8 change) that loop was 13% of the samples. The head is now copied with one slice copy per step and the count advanced once; the bytes kept and the state left are the same. Streaming walk, best of 40 in memory (examples/stream_throughput), against origin/main, Apple M2 Max under load: R2004 sample_AC1018 5.76 ms -> 5.40 ms (x1.07) R2010 sample_AC1024 7.05 ms -> 6.58 ms (x1.07) R2013 sample_AC1027 5.45 ms -> 5.14 ms (x1.06) R2018 sample_AC1032 5.44 ms -> 5.12 ms (x1.06)
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
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
The object framer kept the first 32 payload bytes of every record (to read its type and handle from) with a per-byte function that also bumped the byte count. It now copies the head with one slice copy per step and advances the count once. The bytes kept and the state left are the same.
Profile (Time Profiler, R2010 streaming walk after the CRC-8 change in the sibling PR): that loop was 13% of the samples (
records.rskeep, 8.8% and 4.5% on the two lines).Streaming walk, best of 40 in memory (
examples/stream_throughput, Apple M2 Max under load), againstorigin/mainata315f04:sample_AC1018sample_AC1024sample_AC1027sample_AC1032R14 and R2000 frame records in
FlatWalker, not this framer, and did not move.Spec reference
§20.1 (record framing), 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_objects.py(32 files, 8,027 records: every line equal to the independent framing and the legacy reader's records, fixed and proptest chunk schedules, fresh-process resumes in every framer stage, forged checkpoints rejected, corrupt sections each ending in their named error) andverify_wasm_objects.py(native and wasm32 checkpoints byte-identical). Both passed; each writes its binary SHA to its evidence JSON.cargo build --release --example stream_throughput, thentarget/release/examples/stream_throughput <corpus>/acadsharp/sample_AC10{14,15,18,24,27,32}.dwg --runs 40, 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.