Hacker News new | past | comments | ask | show | jobs | submit login

> "YAY! JSON is wastefully large. I'd love to replace it." Is this true? I'm confused why JSON would be seen as a wasteful as a format.

It transmits type and field names. Depending on how complex your data is those strings could be a large part of the data.

{ "person": { "age": 30, "shoesize": 10 } }

The above is what, 4-5 bytes of protobuf? I'm not sure what the gzipped-json data is but likely a lot more. If you were to send a list of 100 such person objects, the difference would be smaller.




> The above is what, 4-5 bytes of protobuf?

Assuming the integer fields are regular varint types (and not the "fixed" integer encoding), and assuming the tag numbers were all under 16, then this would be a six-byte protobuf.


Thanks. Admittedly a favourable example for protobufs but it shows the point: the names aren't data.


Yep! This improves decoding speed too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: