Add correctness matrix and property-based tests#11
Merged
Conversation
Adds a comprehensive correctness test harness for encode-path invariants so future encoder variants (L0 contiguous-buffer writer, schema plans, specialized writers) can be validated automatically in CI: - correctness-matrix.test.ts — matrix across encoders × fixtures covering scalars, packed repeated, nested messages, maps, oneofs, and WKTs. 20 tests across 10 fixtures. - round-trip-property.test.ts — seeded property-based round-trip tests (100 random scalars, 50 packed, 50 nested, oneof variants, map ordering, UTF-8, int32/int64 boundaries, deep nesting). 16 tests. - byte-identity.test.ts — strict byte-identical assertions for proto3 default omission, packed vs unpacked repeated, oneof emission, UTF-8 multi-byte codepoints, varint boundaries, and determinism. 18 tests. The ENCODERS registry in each file currently contains only `toBinary`. New encoders (`toBinaryFast`, schema-plan variants) will be added to the registry as they land on main — the matrix will then exercise every pair automatically. Total: 54 new test cases, ~1082 LOC added. Runtime <600ms for the three new files; full protobuf-test suite 2877 tests pass (was 2823). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
intech
added a commit
that referenced
this pull request
Apr 19, 2026
Regenerated after merge of #6 (benchmark matrix), #8 (L0 contiguous writer), #10 (L1+L2 schema plans + specialized writers), #11 (correctness tests). Key results (Node 25.8, log-scale chart): - OTel 100 spans: 525 -> 2,501 ops/s (+376%), 0.80x pbjs (3,110) - OTel Metrics 50: 891 -> 4,773 ops/s (+435%) - OTel Logs 100: 880 -> 3,772 ops/s (+329%) - K8sPodList 20: 712 -> 3,510 ops/s (+393%) - Stress d=8 w=200: 2,568 -> 14,378 ops/s (+460%) - SimpleMessage: 1.39M -> 1.81M ops/s (+30%) Memory allocations per encode reduced proportionally via L0 contiguous buffer + L1 schema-plan opcode interpreter + L2 specialized field writers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
intech
added a commit
that referenced
this pull request
Apr 19, 2026
Regenerated after merge of #6 (benchmark matrix), #8 (L0 contiguous writer), #10 (L1+L2 schema plans + specialized writers), #11 (correctness tests). Key results (Node 25.8, log-scale chart): - OTel 100 spans: 525 -> 2,501 ops/s (+376%), 0.80x pbjs (3,110) - OTel Metrics 50: 891 -> 4,773 ops/s (+435%) - OTel Logs 100: 880 -> 3,772 ops/s (+329%) - K8sPodList 20: 712 -> 3,510 ops/s (+393%) - Stress d=8 w=200: 2,568 -> 14,378 ops/s (+460%) - SimpleMessage: 1.39M -> 1.81M ops/s (+30%) Memory allocations per encode reduced proportionally via L0 contiguous buffer + L1 schema-plan opcode interpreter + L2 specialized field writers. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Adds correctness test harness for encode-path optimizations. Split from #6 which was repurposed as benchmark matrix merge.
What's included
Test coverage
54 new tests across 26 suites covering: proto3 defaults, packed/unpacked repeated, oneof variants, map fields (including integer keys), UTF-8 multi-byte, varint boundaries, determinism invariants.
Encoder registry
ENCODERS array tests `toBinary` and `toBinaryFast` (both now on main after #6/#8/#10). Matrix auto-expands to N×N encoder pairs when new encoders added.
Runtime
551ms isolated, contributes ~5s to full suite.
🤖 Generated with Claude Code