top | item 5086306

(no title)

afuruhed | 13 years ago

Hi, I'm going to update the FAQ. We have started comparing to GPB, please see here.

http://blog.blinkprotocol.org/2013/01/blink-compared-to-goog...

As you can see in a comment by Rolf, part of the perf limitation of GPB is the implementation and not the wire protocol.

Anders

discuss

order

Inufu|13 years ago

Is there a reason why all the fields for protobuf are declared as "optional", when it looks like they are in fact not optional at all?

bchallenor|13 years ago

To support schema evolution. Of course it's up to you to write code that can actually handle missing fields, but once you have a required field in a message, you can never remove it.

From the docs:

"You should be very careful about marking fields as required. If at some point you wish to stop writing or sending a required field, it will be problematic to change the field to an optional field – old readers will consider messages without this field to be incomplete and may reject or drop them unintentionally. You should consider writing application-specific custom validation routines for your buffers instead. Some engineers at Google have come to the conclusion that using required does more harm than good; they prefer to use only optional and repeated. However, this view is not universal."

https://developers.google.com/protocol-buffers/docs/proto

randersson|13 years ago

good question; I usually declare fields optional for the reason described in the reply above. I just re-ran the test with all fields declared as "required". It ran ~2% faster.