Thrift vs. Protocol Buffers
Google recently released its Protocol Buffers as open source. About a year ago, Facebook released a similar product called Thrift. I’ve been comparing them; here’s what I’ve found:
| Thrift | Protocol Buffers | |
|---|---|---|
| Backers | Facebook, Apache (accepted for incubation) | |
| Bindings | C++, Java, Python, PHP, XSD, Ruby, C#, Perl, Objective C, Erlang, Smalltalk, OCaml, and Haskell | C++, Java, Python (Perl, Ruby, and C# under discussion) |
| Output Formats | Binary, JSON | Binary |
| Primitive Types | bool byte 16/32/64-bit integersdouble string byte sequence map<t1,t2> list<t> set<t> |
bool32/64-bit integers float double string byte sequence “repeated” properties act like lists |
| Enumerations | Yes | Yes |
| Constants | Yes | No |
| Composite Type | struct | message |
| Exception Type | Yes | No |
| Documentation | So-so | Good |
| License | Apache | BSD-style |
| Compiler Language | C++ | C++ |
| RPC Interfaces | Yes | Yes |
| RPC Implementation | Yes | No |
| Composite Type Extensions | No | Yes |
Overall, I think Thrift wins on features and Protocol Buffers win on documentation. Implementation-wise, they’re quite similar. Both use integer tags to identify fields, so you can add and remove fields without breaking existing code. Protocol Buffers support variable-width encoding of integers, which saves a few bytes. (Thrift has an experimental output format with variable-width ints.)
The major difference is that Thrift provides a full client/server RPC implementation, whereas Protocol Buffers only generate stubs to use in your own RPC system.
Update July 12, 2008: I haven’t tested for speed, but from a cursory examination it seems that, at the binary level, Thrift and Protocol Buffers are very similar. I think Thrift will develop a more coherent community now that it’s under Apache incubation. It just moved to a new web site and mailing list, and the issue trackeris active.
- 下一篇: BASE64编码的图片在网页中的显示【转】
- 上一篇: Kyoto Cabinet 基本规格书【转】
相关推荐
- Being John Malkovich | Read Book Online
- Posted on 06月08日
- Mondscheintarif | EPUB PDF
- Posted on 08月02日
- Leben. Die ersten vier Milliarden Jahre. – Zusammenfassung PDF
- Posted on 09月21日
- Wołanie grobu : eBooks (EPUB)
- Posted on 10月18日
