Skip to content

Comment on Reasons to use protocol buffers instead of JSON

Comments

I think the main advantages are:

    - network bandwidth/latency: smaller RPC consume less 
      space, are received and responded to faster.
    - memory usage: less data is read and processed while      
      encoding or decoding protobuf.
    - time: haven't actually benchmarked this one, but I 
      assume CPU time spent decoding/encoding will be 
      smaller since you don't need to go from ASCII to 
      binary.
Which means, all performance improvements. They come, as usual, at the cost of simplicity and ease of debugging.

"I assume X is more performant ... I haven't actually benchmarked it"

I believe that's usually spelled "I am making this up".

The vast majority of performance judgments are made without benchmarking, because most of the time the answer is obvious enough without the need to measure.

This is one of those times. Parsing the text "1234" is obviously going to be slower than loading its binary value, and text obviously takes more space than binary.

That said, the internet is full of benchmarks backing this up if you care to Google it.

Or "I'm making an educated guess". Otherwise how can you get truly surprised when things turn out to be different in the real world :-)

I'd also guess it would be more expensive during decoding. So let's compare that with some real data:

https://github.com/eishay/jvm-serializers/wiki (old wiki but with some graphs https://code.google.com/p/thrift-protobuf-compare/wiki/Bench...)

it turns out that state of the art JSON serialisers aren't so bad after all, especially the serialisation.

I think "I assume X" is pretty clear and honest to the fact I'm making an assumption. I don't understand the need to aggressively emphase it.

In a civilized discourse, if you disagree with my assumption because you know better, you should provide information as to why I'm wrong. And I'll be delighted to obtain this new knowledge.

Otherwise, what's the point of your intervention?

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.