WARNING: Benchmarks can be misleading.html
In short, before you make a decision on which tool to use, make sure you try it out in an environment you care about. To start, download the benchmark code and run it on your hardware with data values you care about.java
Hardware: Intel Core 2 Quadgit
Software: Sun JRE 1.6.0_20 (64-bit server VM), Ubuntu 9.10github
JVM options: -Xmx16m -serverapache
Data value being tested: DataStructuresV2.json
Version of the benchmarking code: Git treejvm
Methodology:ide
Tool Versions (lib/):svn
Create an object, serialize it to a byte array, then deserialize it back to an object.oop
Create an object, serialize it to a byte array.
Often the most expensive operation. To make a fair comparison, all fields of the deserialized instances are accessed - this forces lazy deserializers to really do their work. The raw data below shows additional measurements for deserialization.
The size of the serialized data. These numbers may vary depending on the exact data value being used.
The size of the serialized data compressed with Java's built-in implementation of DEFLATE (zlib).
Object creation is not so meaningful since it takes in average 100 nano to create an object. However, the different tools vary in how "fancy" their objects are. Some just create a plain Java class and let you access fields directly, while others have set/get methods, while others use the "builder" pattern.
Times are in nanoseconds, sizes are in bytes.
create ser +same deser +shal +deep total size +dfl protobuf 482 4115 2087 2428 2516 2731 6846 239 149 thrift 408 4139 3869 4609 4851 4894 9032 349 195 thrift-compact 406 4028 3541 4881 4997 5243 9271 240 149 protobuf/activemq+alt 368 4006 9 23 1444 2779 6784 239 149 protobuf/protostuff 356 1399 1123 2197 2277 2436 3835 239 149 protobuf/protostuff-runtime 225 1745 1612 2228 2510 2585 4330 241 150 protostuff-core-ge 358 1328 1067 2265 2345 2486 3814 239 150 protostuff-runtime-ge 225 1686 1539 2273 2552 2617 4303 241 151 kryo 225 2108 1948 2309 2383 2468 4577 233 147 kryo-opt 225 2002 1852 2112 2188 2261 4263 219 135 avro 1857 4674 2758 6065 7222 8001 12675 221 133 avro-generic 2380 5226 2520 5557 6864 7935 13161 221 133 hessian 221 11022 10083 11824 12008 11963 22985 501 313 java-built-in 224 13025 11738 59070 59537 59759 72785 889 517 java-manual 225 1808 1664 1301 1378 1478 3285 255 147 scala/java-built-in 756 20788 17855 88676 89203 89851 110640 1312 700 scala/sbinary 748 4214 3322 2900 3061 3370 7583 255 147 json/jackson-manual 222 6648 6504 4525 4481 4574 11222 398 220 json/jackson-databind 231 10457 10105 6401 6508 6670 17127 503 270 json/protostuff 361 7749 7073 4933 5049 5208 12957 382 194 json/protostuff+numeric 357 7934 7497 4787 4955 5101 13036 360 191 json/protobuf 507 22287 21118 117870 120792 121540 143828 488 253 json/google-gson 241 82257 81695 133003 135203 135314 217571 486 259 xml/manual-woodstox 239 7031 6868 9437 9704 9917 16948 495 267 xml/manual-aalto 239 4680 4179 5910 6031 6135 10815 495 267 xml/manual-fastinfo 224 14245 14017 16293 17032 17309 31553 333 250 xml/xstream 236 85322 82668 141576 142139 141402 226724 758 313 xml/xstream+c 229 15140 14010 49303 49332 47802 62942 381 205 woodstox-xstream 239 87595 84340 141817 142207 140461 228056 796 344 woodstox-xstream+c 221 12674 11355 24154 24303 24579 37253 419 236 aalto-xstream 225 85946 82487 137690 140350 138958 224903 796 344 aalto-xstream+c 223 10812 9495 16718 16915 17339 28151 419 236 fastinfo-xstream 235 104124 100900 123098 124063 123837 227961 444 323 fastinfo-xstream+c 234 20251 18776 23823 24149 24325 44576 293 227 xml/javolution 219 5732 5546 8851 8926 8971 14703 432 239
Columns: