• Feeds

  • Thrift and Protocol Buffers performance in Java Round 2

    In my last test Thrift and Protocol Buffers performance in Java, Some comments told me that there are some tuning parameter for Protocol Buffer which can improve performance magically. The parameter was not turn on by default. I added
    option optimize_for = SPEED
    to the proto file, and re-generated the Java class, and the result:

    Thrift Loop    : 10,000,000
    Get object     : 14,394msec
    Serdes thrift  : 37,671msec
    Objs per second: 265,456
    Total bytes    : 1,130,000,000
    
    ProtoBuf Loop  : 10,000,000
    Get object     : 8,170msec
    Serdes protobuf: 33,054msec
    Objs per second: 302,535
    Total bytes    : 829,997,866
    

    From the result, Protocol Buffers is 1.1 times faster than Thrift!

    And from the Google Protocol Buffers group, why the optimize for speed was not turn on by default.

    When using C++ or Java protocol buffers, for best performance you need to add a line to your .proto files:

    option optimize_for = SPEED;

    Otherwise, by default, the compiler optimizes for code size.  Optimizing for code size results in generated code that around a half to a third of the size, but runs an order of magnitude slower…

    Here is the original post

    如想及时阅读Tim Yang的文章,可通过页面右上方扫码订阅最新更新。

    « | »

    11 Comments  »

    1. What’s up, the whole thing is going perfectly here and ofcourse every one is sharing information, that’s actually good,
      keep up writing.

    2. Which soft are you using for coding? I use Atom and I find it very useful and helpful, I love the colors of the tags.

    3. Thanks for the advise!

    4. Margarita

      Thanks for your efforts in explaining all of this. But do you know what is the difference between drywall and sheetrock? Any suggestions are welcome.

    5. Peter Mercury

      I have tested both of them and Protocol Buffers is faster than Thrift even though the difference is small. I tried them both checking for Rankdle and Protocol Buffers won.

    6. Thrift and Protocol Buffers performance in Java Round 2

    7. Derek Gray

      Always nice to encounter this type of post. This is amazing. Wow! Thank you from our life insurance in colorado springs co

    8. It’s great to see this informative post here.

    9. Mike

      Great to see a Round 2 comparison of Thrift and Protocol Buffers performance in Java! Looking forward to reading the detailed findings. | http://www.drywallbaltimore.com

    Leave a Comment