来源:https://github.com/eishay/jvm-serializers/wiki
For discussions please use the java serialization benchmarking google group.
Disclamer
This test focusses on en/decoding of a cyclefree data structure. Some serializers support cycle detection/object sharing, some offer both modes, some include full metadata, some don’t, some are cross platform, some are language specific, some are text based, some are binary. (See ToolBehavior)
Other test data will yield different results. However the results give a raw estimation of library performance.
java version “1.7.0_51”
Java™ SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot™ 64-Bit Server VM (build 24.51-b03, mixed mode)
SIMPLE/GENERIC:
Serializes any POJO tree without class specific optimization. Serialized classes are known in advance. No cycle detection/shared object detection is done.
Checking correctness…
[done]
Pre-warmup… java-built-in hessian kryo fast-serialization jboss-serialization jboss-marshalling-river protostuff msgpack-databind json/jackson/databind json/jackson/db-afterburner json/protostuff-runtime json/google-gson/databind json/svenson-databind json/flexjson/databind json/fastjson/databind smile/jackson/databind smile/jackson/db-afterburner bson/jackson/databind xml/xstream+c xml/jackson/databind-aalto
[done]
create ser deser total size +dfl java-built-in 63 5838 30208 36046 889 514 hessian 63 3881 6176 10057 501 313 kryo 63 655 838 1493 212 132 fast-serialization 63 704 864 1568 252 166 jboss-serialization 63 6466 6643 13110 932 582 jboss-marshalling-river 63 4656 23892 28548 694 400 protostuff 82 495 732 1227 239 150 msgpack-databind 62 830 1370 2200 233 146 json/jackson/databind 62 1895 2600 4496 485 261 json/jackson/db-afterburner 63 1513 1988 3501 485 261 json/protostuff-runtime 63 1532 2138 3670 469 243 json/google-gson/databind 63 5633 4844 10477 486 259 json/svenson-databind 63 5270 10358 15628 495 272 json/flexjson/databind 63 19445 25394 44838 503 273 json/fastjson/databind 63 1316 1149 2465 486 262 smile/jackson/databind 63 1768 1891 3659 338 241 smile/jackson/db-afterburner 64 1448 1492 2940 352 252 bson/jackson/databind 64 5376 6812 12188 506 286 xml/xstream+c 64 6476 13505 19981 487 244 xml/jackson/databind-aalto 63 3001 5516 8517 683 286
DEFAULT:
Serializes arbitrary object graphs, cycle detection enabled. Nothing is known in advance about the classes to serialize. Only serializers supporting full object graph serialization are included.
Checking correctness…
[done]
Pre-warmup… java-built-in-serializer hessian kryo-serializer fast-serialization-shared jboss-serialization
[done]
create ser deser total size +dfl java-built-in-serializer 64 5723 29259 34982 889 514 hessian 64 3611 6169 9780 501 313 kryo-serializer 64 1711 1499 3210 311 198 fast-serialization-shared 64 1621 1592 3212 341 212 jboss-serialization 64 6442 6339 12781 932 582
SIMPLE/SPECIFC: Serializes only specific classes using code generation or other special knowledge about the class.
Checking correctness…
[done]
Pre-warmup… kryo-opt wobly wobly-compact protobuf protostuff protobuf/protostuff thrift thrift-compact avro json/json-lib-databind json/jsonij-jpath
[done]
create ser deser total size +dfl kryo-opt 64 658 864 1522 209 129 wobly 43 886 536 1422 251 151 wobly-compact 43 903 569 1471 225 139 protobuf 130 1225 701 1926 239 149 protostuff 82 488 678 1166 239 150 protobuf/protostuff 83 598 692 1290 239 149 thrift 126 1796 795 2591 349 197 thrift-compact 126 1555 963 2518 240 148 avro 89 1616 1415 3031 221 133 json/json-lib-databind 63 26330 103150 129479 485 263 json/jsonij-jpath 63 38015 12325 50339 478 259
MANUAL:
Serializes only specific classes using hand written serialization code.
Checking correctness…
[done]
Pre-warmup… java-manual kryo-manual protostuff-manual avro-generic json/jackson/manual json/protostuff-manual json/google-gson/manual json/json.simple/manual json/json-smart/manual/tree json/org.json/manual/tree json/argo-manual/tree smile/jackson/manual bson/mongodb xml/woodstox-manual xml/aalto-manual xml/xstream+c-woodstox xml/xstream+c-aalto xml/xstream+c-fastinfo xml/javolution xml/fastinfo-manual
[done]
create ser deser total size +dfl java-manual 63 847 632 1480 255 147 kryo-manual 63 555 616 1171 211 131 protostuff-manual 63 465 711 1176 239 150 avro-generic 379 1822 1125 2947 221 133 json/jackson/manual 63 1097 1539 2636 468 253 json/protostuff-manual 63 1345 1816 3161 449 233 json/google-gson/manual 63 3696 3756 7452 468 253 json/json.simple/manual 63 6184 8059 14243 495 269 json/json-smart/manual/tree 63 5314 4088 9402 495 269 json/org.json/manual/tree 63 6989 8413 15403 485 259 json/argo-manual/tree 63 66575 14578 81153 485 263 smile/jackson/manual 63 939 1092 2031 341 244 bson/mongodb 64 3422 7762 11184 495 278 xml/woodstox-manual 63 3159 4578 7737 653 304 xml/aalto-manual 63 2077 3093 5170 653 304 xml/xstream+c-woodstox 63 5638 10506 16144 525 273 xml/xstream+c-aalto 63 4893 8912 13805 525 273 xml/xstream+c-fastinfo 63 8451 7971 16422 345 264 xml/javolution 64 5544 8538 14082 504 263 xml/fastinfo-manual 64 6959 5420 12379 377 284