[erlang-questions] fyi: Google protocol buffers

Adam Lindberg adam@REDACTED
Tue Jul 8 12:53:19 CEST 2008

How dose this relate to, say, JSON?

I have little experience in JSON but I imagined that is is sort of the
task JSON was designed for, i.e. information serialization.

...  ¬_¬

Here I'm answering my own question, this is taken from the Protocol
Buffers Google Group:
From: "Kenton Varda" <ken...@REDACTED>
Date: Mon, 7 Jul 2008 20:02:27 -0700
Local: Tues, Jul 8 2008 5:02 am
Subject: Re: json?

On Mon, Jul 7, 2008 at 7:07 PM, tommy <wheels...@REDACTED> wrote:
> What are the advantages of protocol buffers over JSON?

Two things, mainly:
1) Protocol Buffers are smaller and -- assuming you are not just using
exec() to parse your JSON -- faster to parse.
2) Protocol Buffers give you nice auto-generated, type-safe classes to
manipulate your message types.  With JSON you just get a string->string map.
 On the other hand, in a dynamically-typed language there might not be a
huge difference.

Disadvantages include:
1) Cannot just use exec() to parse; you need a parsing library.
2) Not human-readable (unless you use the TextFormat class, but then you
don't get the efficiency benefits).

Note that it would make sense to write some code -- similar to what
TextFormat does -- which encodes and decodes protocol messages in JSON
format using protobuf reflection.  This shouldn't be very hard, especially
if you start by copying the TextFormat code.  We might include such a thing
in a future release.

Adam Lindberg

On Tue, Jul 8, 2008 at 10:01, Christian S <chsu79@REDACTED> wrote:
> http://code.google.com/apis/protocolbuffers/docs/overview.html
> "Protocol buffers are now Google's lingua franca for data – at time of
> writing, there are 48,162 different message types defined in the
> Google code tree across 12,183 .proto files. They're used both in RPC
> systems and for persistent storage of data in a variety of storage
> systems."
> They're using it over XML, which I find noble (apparently XML has too
> much overhead even if you have thousands of machines, who would have
> known?), but protocol buffers it is no UBF.  :-)
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list