News for hackers. Stuff that matters.
Re:Serializing Data - JSON vs. Protocol Buffers by jacquesm on Monday August 17, 2009 @08:12AM (#767904)
Conclusion, if you're developing for the Android platform you may want to use protocol buffers, otherwise use JSON.

I'm quite surprised at how large that library is and how badly it performs, especially since it does less translation than a comparable JSON serializer would.

For a complete comparison it would have been nice to include XML as well.

Re:Serializing Data - JSON vs. Protocol Buffers by jpschorr on Monday August 17, 2009 @08:50AM (#767964)
It should probably be noted that the Python implementation currently works much differently than the C++ and Java implementations.

The C++ and Java versions generate code for each message type defined in a your proto file (in fact there an option that let's you specify to optimize for speed). The python version on the other hand creates an object representing the proto file, and reflects upon it for serialization/deserialization.

Re:Serializing Data - JSON vs. Protocol Buffers by fauigerzigerk on Monday August 17, 2009 @10:32AM (#768181)
Conclusion, if you're developing for the Android platform you may want to use protocol buffers, otherwise use JSON.

We have four variables that might influence performance:

a) the algorithm used in the library's implementation

b) the programming language/runtime used

c) the operating system

d) whether json or pb is used

Now your conclusion implies that only c and d matter. That doesn't make sense to me.

Re:Serializing Data - JSON vs. Protocol Buffers by axod on Monday August 17, 2009 @10:38AM (#768192)
>> "For a complete comparison it would have been nice to include XML as well."

Might have needed a logarithmic scale to include it ;)

Re:Serializing Data - JSON vs. Protocol Buffers by stingraycharles on Monday August 17, 2009 @08:53AM (#767968)
I wonder whether the author used the 'optimize_for=SPEED' parameter in Protocol Buffers. Seems relevant, and since the author didn't mention it, I suppose he probably didn't.

I personally have a hard time accepting that PB is actually orders of magnitude slower than JSON, especially given the fact that PB prides itself in its efficiency.

Re:Serializing Data - JSON vs. Protocol Buffers by metachris on Monday August 17, 2009 @09:05AM (#767991)
i didn't use the optimize_for=SPEED option but will do that right now and update it in half an hour.

EDIT: I just added the option *optimize_for=SPEED to the .proto file, and it increases the speed of the Protocol Buffers by around 5% (still 10 x more than JSON with Python).

> I personally have a hard time accepting that PB is actually orders of magnitude slower than JSON

it's not always slower, but in certain situations yes. it seems that the Python implementation is especially slow -- would be nice to see the results with C++. anyone cares to give it a shot?

Re:Serializing Data - JSON vs. Protocol Buffers by james2vegas on Monday August 17, 2009 @10:44PM (#769637)
And ASN.1. Yet another Google re-invention of the wheel.