perf: optimize varint and packed fixed-width paths#39
Conversation
Add a direct fast path for one-byte varint reads and replace length-delimited size parsing's hot Result chain with direct checks. Regenerate the checked smoke runtime output and cover the source shape with a focused runtime test. Benchmarked with repeated Google Benchmark JSON output; the kept parse-only candidate avoided the write-side regression seen in broader variants.
Add direct host smoke coverage for read_varint canonical byte sequences, including single-byte values, two-byte values, and the 10-byte uint64 maximum. Cover truncated continuation input and overflowing 10th-byte input so the runtime helper optimization is pinned to observable wire-format behavior.
Add runtime helpers for bulk fixed-width packed scalar read/write paths and wire generated C++ to use them where safe. Reduce generated hot-path lambda/monadic chaining while preserving explicit status propagation and add smoke/plugin coverage for the optimized source shape.
42ddfbb to
4935b4a
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4935b4a95b
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Restrict generated fixed-width packed direct parsing to little-endian readers whose field storage exposes a Status-returning bulk reader append API, preserving staged rollback behavior for other paths. Preserve aliased Vector::append_trivial_range sources across reserve growth and keep range assignment constructor fallback available for assignable-but-not-default-constructible element types. Add smoke regressions and update generated header shape assertions.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6490426b92
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Guard generated packed scalar commit fast paths behind append_trivial_range support so custom Vector implementations can use the reserve/push_back fallback. Return fixed-width packed preflight errors before appending to the caller output, including misaligned byte counts and readable-size failures. Document the current custom Config surface directly and add smoke regressions for push-only vectors and malformed fixed-width packed payloads.
17e4979 to
8486c1a
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Performance and Size Notes
protocyte_host_benchmark.exeremains523,776bytes after the retained changes.Verification
uv run ruff check src\protocyte\cpp.py tests\test_plugin.pyuv run pytest tests\test_plugin.py -qgit diff --check HEAD~1..HEADcmake --build tests\smoke\build\clangcl --target protocyte_host_smoke -- -j1tests\smoke\build\clangcl\protocyte_host_smoke.execmake --build tests\smoke\build\clangcl-benchmarks --target protocyte_host_benchmark protocyte_host_benchmark_smoke -- -j1tests\smoke\build\clangcl-benchmarks\protocyte_host_benchmark_smoke.exe