Have you stepped through protobuf processing code? There's a lot of special cases, ifs, branches here and there. Protobufs within protobufs. Its not like its a size, then 100 floats packed together, theres more overhead than youd think. (Not to mention the client side allocations etc etc)
I use protoc compiled to wasm for protobufs and it is fast, but theres a lot of wasm overhead to execute that code.Json parsing is also a lot of special cases, error testing, but the v8 team has spent a huge amount of time optimising json parsing (theres a few blog posts on it).
Im not assuming either way, but it's definitely as cut and dry as one would assume.
throw827474737|3 years ago
dekhn|3 years ago
However, "packed" fields are exactly a length followed by a byte array of the typed data. This was an oversight in original proto2 which is unlikely to be corrected, but packed the default in proto3.
jeffbee|3 years ago