I was reading this comparison yesterday and was woried about PB 
performance... But today I studied a little more about JSON and I would 
like to share this:

JSON is not at all comparable with ProtBuf, it is much much simpler. It 
is just a way of putting variables in a pack.

ProtBuf is a much more complex system that can send *entire structures*, 
with an administration that make programs of *different versions* talk 
to each other, *back-and-forward compatible*.

So I believe that comparing them is like oranges versus apples...

I would appreciate more comments on this ;)


Dave Bailey escreveu:
> Justin,
> Thanks for writing this up; I think it's a nice "real world" example.
> I ran an equivalent test (using your same .proto files) in Perl to
> compare JSON::XS, protobuf-perlxs, and Storable.  I did this on an
> x86_64 quad-core Xeon (2.5 GHz) and found:
> 1) Your original dns.proto (with strings), serializing and
> deserializing a DnsResponse with 5000 random DnsRecord elements:
> 0.019414 seconds to serialize as 658358 bytes with JSON
> 0.009672 seconds to deserialize 658358 bytes with JSON
> 0.030239 seconds to serialize as 415044 bytes with protobuf-perlxs
> 0.011978 seconds to deserialize 415044 bytes with protobuf-perlxs
> 0.029631 seconds to serialize as 693291 bytes with Storable
> 0.009553 seconds to deserialize 693291 bytes with Storabe
> 2) Your modified dns.proto (sip/dip/sport/dport), serializing and
> deserializing a DnsResponse with 10000 random DnsRecord elements:
> 0.003501 seconds to serialize as 300322 bytes with JSON
> 0.005016 seconds to deserialize 300322 bytes with JSON
> 0.009567 seconds to serialize as 85838 bytes with protobuf-perlxs
> 0.004225 seconds to deserialize 85838 bytes with protobuf-perlxs
> 0.014848 seconds to serialize as 340886 bytes with Storable
> 0.004669 seconds to deserialize 340886 bytes with Storabe
> I timed the actual serialization part only, and excluded the time to
> generate the Perl data structure that is serialized (since that has
> nothing to do with the serialization per se).  With protobuf-perlxs,
> deserialization is comparable in performance to JSON::XS and Storable
> in Perl.  Serialization is slower, but not extraordinarily slow.  It
> seems to be within a factor of 2 or 3.  From what I know of Python, a
> Python/C++ protobuf port (e.g. "protopy") would generate code that
> exhibits similar performance characteristics.  We have had really good
> success with Perl/XS in terms of performance.  I did not do a
> comparison with Thrift/Perl, but I'm guessing we compare favorably.
> -dave
> On Mar 2, 8:48 am, Justin  Azoff <justin.az...@gmail.com> wrote:
>> On Mar 2, 10:52 am, Stephan Richter <stephan.rich...@gmail.com> wrote:
>>> The outcome looks about right. In the latest version of Python, even
>>> simplejson has C extensions. A one order of magnitude difference between a
>>> pure Python versus C implementation is about right, if not too small. I 
>>> would
>>> have expected a difference of 20-50 times.
>>> Besides the fact that this post is is far too short on details - i.e. Python
>>> version, OS, hardware -- I would look at it as a great motivation to get the
>>> C extensions for PB done quickly. ;-)
>>> Regards,
>>> Stephan
>> Hi all :-)
>> I actually posted a follow 
>> up:http://bouncybouncy.net/ramblings/posts/more_on_json_vs_thrift_and_pr...
>> It turned out I didn't have the simplejson C extension installed...
>> With that installed the speed difference was much greater.
>> The test were run on python2.4 on a 3.2gz p4.
>> Aside from the speed I really like Protocol Buffers, the API and docs
>> are very well done :-)
>> - Justin
> > 

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to