News for hackers. Stuff that matters.
Re:Protobuf-ES: The Protocol Buffers TypeScript/JavaScript r... by capableweb on Monday October 31, 2022 @07:45AM (#33404476)
As always, each protocol/data format has it's place. You need to maximize the amount of data you send in each packet? Then protobuf is better than JSON. Need to support large amount of clients without any fuzz? Then JSON is better. Wanna pass around data you don't know the schema of? JSON again.

Contexts matters, there is no silver bullets, everything has trade offs and so on, and so on.

Re:Protobuf-ES: The Protocol Buffers TypeScript/JavaScript r... by speedgoose on Monday October 31, 2022 @07:54AM (#33404543)
JSON messages in a compressed websocket stream are surprisingly tiny. Bigger than compressed protobuf packets but not by much, and much smaller than uncompressed protobuf packets.
Re:Protobuf-ES: The Protocol Buffers TypeScript/JavaScript r... by capableweb on Monday October 31, 2022 @10:59AM (#33406702)
Yeah, which is probably fine in most cases but sometimes not (maybe the overhead is just 1.5x, but if you're doing thousands of messages per second (not the usual API<>browser communication for web users)) and then it matters. Again it's trade-offs and highly contextual.
Re:Protobuf-ES: The Protocol Buffers TypeScript/JavaScript r... by ninepoints on Monday October 31, 2022 @07:54AM (#33404536)
Honestly, gzipped json is likely much smaller than uncompressed protobuf.

If you were going to use a binary protocol, why choose one that has no partial parsing/toc these days. There are much better alternatives IMO (flatbuffers being one of them)

Re:Protobuf-ES: The Protocol Buffers TypeScript/JavaScript r... by oll3 on Monday October 31, 2022 @06:34PM (#33414277)
> Honestly, gzipped json is likely much smaller than uncompressed protobuf.

Likely not. See here for a comparison: https://nilsmagnus.github.io/post/proto-json-sizes/

Btw, binary formats can also be compressed though it typically won't yield the same compression ratio as similar json would since there will be less repeation in the binary format.

Re:Protobuf-ES: The Protocol Buffers TypeScript/JavaScript r... by ninepoints on Sunday November 13, 2022 @08:04PM (#33589104)
Or, we could have done a comparison with large strings and see the opposite result. Silly benchmark is silly (or should I say, specific)
Re:Protobuf-ES: The Protocol Buffers TypeScript/JavaScript r... by maccard on Monday October 31, 2022 @09:02AM (#33405146)
> Wanna pass around data you don't know the schema of? JSON again.

This is a false flag. If you don't know the schema on the receiving (or sending, for that matter) side, then you can't do anything with the data, other than pass it on. If you _do_ know what it looks like, then it has an implicit schema whether you call it a schema or not.

Re:Protobuf-ES: The Protocol Buffers TypeScript/JavaScript r... by francislavoie on Monday October 31, 2022 @09:09AM (#33405215)
At the time, we needed interop with C. So that's why we chose protobufs. But it was a nightmare to work with in other languages. Including C++ for cross platform desktop apps where cross compiling became a problem too.

JSON in C is unfortunately way harder than in other modern languages (e.g. Go which makes it a breeze with struct tags and a great stdlib).

Re:Protobuf-ES: The Protocol Buffers TypeScript/JavaScript r... by depr on Monday October 31, 2022 @10:06AM (#33405850)
Surely the technical requirements of my specific use case are applicable to any use case.