Apache Thrift和谷歌的协议缓冲区最大的优点和缺点是什么?
当前回答
根据维基百科的说法,Thrift运行时不能在Windows上运行。
其他回答
同样重要的是要注意,并非所有受支持的语言都与thrift或protobuf一致。在这一点上,除了底层序列化之外,还涉及到模块实现的问题。注意检查您计划使用的语言的基准。
Protobuf序列化对象大约比Thrift小30%。 你可能想用protobuf对象做的大多数操作(创建、序列化、反序列化)都比thrift慢得多,除非你打开optimize_for = SPEED选项。 Thrift具有更丰富的数据结构(Map, Set) Protobuf API看起来更干净,尽管生成的类都打包为内部类,这不是很好。 节俭枚举不是真正的Java枚举,也就是说,它们只是整数。Protobuf有真正的Java枚举。
要进一步了解差异,请查看这个开放源代码项目的源代码差异。
正如我在“节俭vs协议缓冲区”主题中所说:
参考Thrift vs Protobuf vs JSON的比较:
Thrift supports out of the box AS3, C++, C#, D, Delphi, Go, Graphviz, Haxe, Haskell, Java, Javascript, Node.js, OCaml, Smalltalk, Typescript, Perl, PHP, Python, Ruby, ... C++, Python, Java - in-box support in Protobuf Protobuf support for other languages (including Lua, Matlab, Ruby, Perl, R, Php, OCaml, Mercury, Erlang, Go, D, Lisp) is available as Third Party Addons (btw. Here is SWI-Prolog support). Protobuf has much better documentation and plenty of examples. Thrift comes with a good tutorial Protobuf objects are smaller Protobuf is faster when using "optimize_for = SPEED" configuration Thrift has integrated RPC implementation, while for Protobuf RPC solutions are separated, but available (like Zeroc ICE ). Protobuf is released under BSD-style license Thrift is released under Apache 2 license
此外,对于这些解决方案,还有许多有趣的附加工具可用,这可能会决定。以下是Protobuf的示例:Protobuf-wireshark, protobufeditor。
根据维基百科的说法,Thrift运行时不能在Windows上运行。
与python上的protobuff相比,我能够使用基于文本的协议获得更好的性能。然而,没有类型检查或其他花哨的utf8转换等…这是protobuff提供的。
因此,如果序列化/反序列化是您所需要的,那么您可能可以使用其他方法。
http://dhruvbird.blogspot.com/2010/05/protocol-buffers-vs-http.html
推荐文章
- 如何JSON序列化集?
- 如何将TimeSpan序列化为XML
- 如何在Intellij生成串行版本UID
- 在Go中使用JSON Marshal的小写JSON键名
- 什么是序列化?
- 我如何复制一个哈希在Ruby?
- 为什么生成较长的serialVersionUID而不是简单的1L?
- 将流转换为字符串并返回
- Parcelable遇到IOException写入序列化对象getactivity()
- 谷歌协议缓冲区vs json vs XML
- 不带空格的Python - json
- 打印对象的所有属性
- 在Swift中将字典转换为JSON
- 将类实例序列化为JSON
- 任务不可序列化:java.io.NotSerializableException,当只对类而不是对象调用闭包外部的函数时