Ok, here's some more interesting benchmark data. Let's start with a
measurement done by someone not associated with Aalto project:
http://www.eishay.com/2008/11/protobuf-with-option-optimize-for-speed.html
Doesn't look too good for Stax? Well, I thought I'll figure out what's
going on. Turns out that:
(a) Stax implementation is the reference implementation (yuck)
(b) For each single serialization/deserialization, a new
XMLInput/OutputFactory is created via factory.newInstance(). OUCH!
Fixing these obvious flaws, starting by using Woodstox improves
reading speed by 8x and writing by 10x. Which brings stax-based
solution to about 40% of speed for reading, and almost 100% speed for
writing (binary formats tend to be relatively faster to read than
write).
But plug in Aalto and results (numbers are milliseconds) are:
---
using Aalto as Stax impl:
warming up...
Starting
,Object create, Serializaton, Deserialization, Serilized Size
thrift, 1304.13260, 23069.41900, 24145.53400, 314
protobuf, 2081.43830, 26319.83200, 15060.01900, 217
java, 973.97880, 75996.27200, 260578.72200, 845
scala, 655.33490, 118616.22600, 548926.90300, 1473
stax, 1003.50770, 17027.86700, 27728.39200, 406
---
And it turns out that for this (real world, I think) use case, Aalto
(a) is bit faster at writing data than either Thrift or Protocol
Buffers (17 ms vs 23 ms vs 26 ms)
(b) is bit slower at reading data (27 vs 24 vs 15)
(c) -> end-to-end, all 3 are about as fast (44 vs 47 vs 41)
(and this despite the fact that message size ratios are 400:300:200)
So, it appears that Aalto is pretty efficient at what it does. I mean,
Protocol Buffers is supposed to be, what, 10 - 100x faster than xml.
So Aalto must be 10x - 100x faster than format it deals with. Not too
shabby!
-+ Tatu +