Commit 295063e
committed
perf(parsers): transcode protobuf wire bytes straight to proto3 JSON
Protobuf.Schema.parse and parseStream now decode protobuf bytes directly to a
proto3-JSON string against the descriptor (pb_transcode), skipping the
intermediate prost_reflect DynamicMessage tree + serde serialization. One pass,
length-delimited values referenced in place.
This is both faster and lighter:
parse (50k-element catalog): ~6.0s -> ~4.6s (gap to node 5.3x -> 4.0x)
whole-parse peak RSS: ~100 MB -> ~63 MB
Output is identical to the previous prost-reflect serialization — a differential
unit test (transcode_matches_prost_reflect) pins byte-for-value parity across
every scalar type, enums, nested messages, repeated (packed + message), and maps.
Suite 80/80; protobuf round-trip/advanced/stream conformance unchanged.
The remaining gap to node is the JSON-string bridge into V8 (JSON.parse, kept
deliberately — direct Value marshaling is slower) plus per-message bucketing.1 parent 8fe42aa commit 295063e
2 files changed
Lines changed: 453 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
9 | 18 | | |
10 | 19 | | |
11 | 20 | | |
| |||
0 commit comments