ipx-wire converted every protobuf answer at run time through prost-reflect and serde_json::Value, so protobuf cost more than the JSON it replaced: decoding 1,488 feeds took 1.50 ms that way against 0.37 ms for serde_json and 0.09 ms for prost's own structs, and GET /api/feeds as protobuf answered about 4 ms after JSON. build.rs now generates those structs (prost-build from protox's descriptors, still no protoc). An answer's JSON goes straight into its struct with serde and out with prost, byte for byte what the runtime path wrote (a test says so); bodies holding a google.protobuf.Value keep the runtime path, as they are only ever read. ipx's calls to the directory and ipx-play build and read the structs directly, through From conversions beside the directory's own types. The page asks for protobuf too, to see what it does in practice. It reads it with web/src/wire.ts, about seventy lines and no library: protobufjs alone was larger gzipped than all protobuf saves the page. build.mts reads the .proto files into a table for it, and the answer names its message in its Content-Type, so the page keeps no table of routes. An answer of null stays JSON, since the empty message would be a feed row of defaults. The offline worker decodes a kept answer to mark what was read offline, and hands the page JSON. The decoder's test caught `pos += varint()[0]`, which adds the length to pos as it was before the varint was read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2.5 KiB
2.5 KiB