-
Notifications
You must be signed in to change notification settings - Fork 561
Newer Results on Different Hardware
(The test platform data isn’t specific enough; this test was run on a Manjaro Linux laptop with an i7-8750H hexacore CPU @ 2.20GHz and 16GB DDR4 RAM, with the test run off of an SSD that also holds AdoptOpenJDK 8. Java versions newer than 8 seem to break Thrift and block compilation, so I am pretty sure I disabled it here… if Thrift is going to be broken on current Java releases then its performance is irrelevant. While Thrift files need to be compiled for jvm-serializers to build, it isn’t possible to run these tests with a newer JVM version.)
OS:Linux
JVM:Oracle Corporation 1.8.0_222
CPU:null os-arch:null
Cores (incl HT):12
This test focusses on en/decoding of a cyclefree data structure, but the featureset of the libraries compared differs a lot:
- some serializers support cycle detection/object sharing others just write non-cyclic tree structures
- some include full metadata in serialized output, some don’t
- some are cross platform, some are language specific
- some are text based, some are binary,
- some support versioning forward/backward, both, some don’t
(See ToolBehavior)
Other test data will yield different results (e.g. adding a non ascii char to every string :-) ). However the results give a raw estimation of library performance.
Benchmarks serializers
- Only cycle free tree structures. An object referenced twice will be serialized twice.
- no manual optimizations.
- schema is known in advance (pre registration or even class generation). (Not all might make use of that)
Ser Time+Deser Time (ns)
Size, Compressed size [light] in bytes
create ser deser total size dfl
colfer 41 227 396 623 241 152
protostuff 68 352 634 986 242 153
json-array/dsl-json/databind 51 433 557 990 296 187
kryo-registered-flat 52 448 574 1023 218 138
fst-flat-pre 53 487 638 1125 254 168
protobuf 249 720 427 1147 242 152
json-array/fastjson/databind 50 648 701 1349 284 171
json/dsl-json/databind 52 480 878 1358 488 271
kryo-auto-flat 58 601 808 1409 274 183
smile-col/jackson/databind 52 689 962 1651 255 168
cbor-col/jackson/databind 52 682 1000 1682 252 165
msgpack/databind 51 735 983 1718 236 150
protobuf/jacksonafterburner/databind 51 726 1007 1733 242 151
cbor/jackson+afterburner/databind 51 801 1045 1845 398 251
smile/jackson+afterburner/databind 52 811 1053 1864 355 259
json-col/jackson/databind 56 783 1164 1947 296 187
flatbuffers 50 1283 810 2093 424 234
smile/jackson/databind 56 848 1273 2121 341 248
protobuf/jackson/databind 53 900 1299 2199 242 151
json/fastjson/databind 51 1014 1190 2203 489 271
json/jackson+afterburner/databind 56 958 1299 2257 488 271
cbor/jackson/databind 57 958 1448 2406 398 251
capnproto 52 1605 919 2525 400 210
json/protostuff-runtime 51 1137 1532 2669 472 252
json/jackson-jr/databind 51 1124 1558 2682 471 263
json/jackson/databind 50 1088 1630 2717 488 271
xml/jackson/databind 51 2095 3826 5921 686 296
json/gson/databind 52 3725 3247 6971 489 268
xml/xstream+c 56 4174 10018 14192 490 253
json/javax-tree/glassfish 1050 6512 10060 16571 488 273
xml/exi-manual 52 9787 8818 18605 340 331
java-built-in 52 4375 19577 23952 892 520
json/protobuf 237 6077 43021 49098 500 262
json/json-lib/databind 51 21409 66142 87551 488 273
Contains serializer(-configurations)
- supporting full object graph write/read. Object graph may contain cycles. If an Object is referenced twice, it will be so after deserialization.
- nothing is known in advance, no class generation, no preregistering of classes. Everything is captured at runtime using e.g. reflection.
- note this usually cannot be used cross language, however JSON/XML formats may enable cross language deserialization.
Ser Time+Deser Time (ns)
Size, Compressed size [light] in bytes
create ser deser total size +dfl
protostuff-graph 68 513 655 1168 242 153
protostuff-graph-runtime 56 654 710 1364 244 154
kryo-registered 57 1037 894 1931 236 149
kryo-auto 51 1250 1220 2470 292 195
fst 52 1294 1257 2551 319 208
jboss-marshalling-river-ct 57 2173 1715 3888 301 203
hessian 53 2839 3799 6638 504 319
jboss-serialization 51 5013 5567 10580 935 587
xml/JAXB/aalto 57 3977 9417 13394 705 327
jboss-marshalling-river 52 3217 12756 15972 697 407
java-built-in-serializer 58 4188 19294 23482 892 520
stephenerialization 52 4891 19786 24678 1096 522
jboss-marshalling-serial 52 7600 17390 24991 859 503
json/flexjson/databind 51 10336 16249 26585 506 282
xml/JAXB 51 3780 104378 108157 722 338
Contains serializer(-configurations)
- Only cycle free tree structures. An object referenced twice will be serialized twice.
- schema is known in advance (pre registration, intermediate message description languages, class generation).
Ser Time+Deser Time (ns)
Size, Compressed size [light] in bytes
create ser deser total size +dfl
colfer 41 227 396 623 241 152
protobuf/protostuff 68 344 634 978 242 152
protobuf/protostuff-runtime 57 498 608 1106 244 153
protobuf 249 720 427 1147 242 152
msgpack/databind 51 735 983 1718 236 150
flatbuffers 50 1283 810 2093 424 234
cbor/jackson/databind 57 958 1448 2406 398 251
capnproto 52 1605 919 2525 400 210
hessian 53 2839 3799 6638 504 319
- text format based. Usually can be read by anybody. Frequently inline schema inside data.
- Mixed regarding required preparation, object graph awareness (references).
Ser Time+Deser Time (ns)
Size, Compressed size [light] in bytes
create ser deser total size dfl
json-array/dsl-json/databind 51 433 557 990 296 187
json-array/fastjson/databind 50 648 701 1349 284 171
json/dsl-json/databind 52 480 878 1358 488 271
smile-col/jackson/databind 52 689 962 1651 255 168
cbor-col/jackson/databind 52 682 1000 1682 252 165
json-col/jackson/databind 56 783 1164 1947 296 187
json/fastjson/databind 51 1014 1190 2203 489 271
json/protostuff-runtime 51 1137 1532 2669 472 252
json/jackson-jr/databind 51 1124 1558 2682 471 263
json/jackson/databind 50 1088 1630 2717 488 271
xml/jackson/databind 51 2095 3826 5921 686 296
json/gson/databind 52 3725 3247 6971 489 268
xml/JAXB/aalto 57 3977 9417 13394 705 327
xml/xstreamc 56 4174 10018 14192 490 253
json/javax-tree/glassfish 1050 6512 10060 16571 488 273
xml/exi-manual 52 9787 8818 18605 340 331
json/flexjson/databind 51 10336 16249 26585 506 282
json/protobuf 237 6077 43021 49098 500 262
json/json-lib/databind 51 21409 66142 87551 488 273
xml/JAXB 51 3780 104378 108157 722 338
all flavours of manually optimized serializers. Handcoded and hardwired to exactly the benchmark’s message structures.
- illustrates what’s possible, at what level generic approaches can be optimized in case
Ser Time+Deser Time (ns)
Size, Compressed size [light] in bytes
create ser deser total size dfl
kryo-manual 53 330 454 784 211 133
protostuff-manual 50 337 644 981 242 153
kryo-opt 52 438 561 999 215 135
datakernel 58 548 497 1045 228 137
wobly 33 660 497 1156 254 155
java-manual 52 619 588 1207 258 151
wobly-compact 33 702 528 1231 228 143
smile/jackson/manual 50 686 872 1558 344 252
cbor/jackson/manual 56 696 934 1630 389 245
msgpack/manual 50 789 1010 1799 236 150
json/jackson/manual 52 832 1109 1941 471 262
jboss-marshalling-river-ct-manual 52 1202 1039 2242 292 171
json/protostuff-manual 56 1027 1376 2403 452 242
avro-generic 291 1597 875 2472 224 136
avro-specific 79 1561 1260 2821 224 136
xml/aalto-manual 57 1596 2119 3715 656 314
jboss-marshalling-river-manual 52 1445 3514 4959 486 244
json/gson/manual 51 2349 2787 5136 471 262
xml/woodstox-manual 57 2091 3230 5321 656 314
json/json-smart/manual-tree 53 3981 3209 7190 498 274
json/gson/manual-tree 51 3930 3980 7911 488 268
xml/fastinfo-manual 51 4476 3825 8301 380 290
bson/mongodb/manual 56 2067 6499 8566 498 286
xml/xstreamc-aalto 51 2902 5904 8806 528 282
xml/javolution/manual 52 4532 5635 10167 507 273
xml/xstream+c-fastinfo 52 4890 5303 10194 348 271
xml/xstream+c-woodstox 52 3428 6962 10390 528 282
json/org.json/manual-tree 57 5217 5895 11111 488 268
json/json.simple/manual 51 5214 7058 12272 498 274
json/svenson/databind 52 3272 9671 12943 501 271
json/javax-stream/glassfish 51 4629 8600 13229 471 262
json/jsonij/manual-jpath 52 16723 8312 25035 484 264
json/argo/manual-tree 51 52499 10616 63115 488 273
shows performance vs convenience of manually-selected libs.
- cycle free, schema known at compile time, manual optimization: kryo-manual, msgpack/manual
- cycle free, schema known at compile time: protostuff, fst-flat-pre, kryo-flat-pre. (note: protostuff uses class generation while the other two just require a list of classes to be written)
- cycle free, schema UNKNOWN at compile time: fst-flat, kryo-flat, protostuff-runtime, msgpack/databind
- full object graph awareness, schema UNKNOWN at compile time: fst, kryo.
Ser Time+Deser Time (ns)
Size, Compressed size [light] in bytes
create ser deser total size +dfl
kryo-manual 53 330 454 784 211 133
protostuff 68 352 634 986 242 153
protostuff-runtime 51 483 629 1112 244 154
fst-flat-pre 53 487 638 1125 254 168
msgpack/databind 51 735 983 1718 236 150
fst-flat 51 751 1031 1782 317 207
msgpack/manual 50 789 1010 1799 236 150
fst 52 1294 1257 2551 319 208
create ser deser total size +dfl colfer 41 227 396 623 241 152 kryo-manual 53 330 454 784 211 133 protobuf/protostuff 68 344 634 978 242 152 protostuff-manual 50 337 644 981 242 153 protostuff 68 352 634 986 242 153 json-array/dsl-json/databind 51 433 557 990 296 187 kryo-opt 52 438 561 999 215 135 kryo-registered-flat 52 448 574 1023 218 138 datakernel 58 548 497 1045 228 137 protobuf/protostuff-runtime 57 498 608 1106 244 153 protostuff-runtime 51 483 629 1112 244 154 fst-flat-pre 53 487 638 1125 254 168 protobuf 249 720 427 1147 242 152 wobly 33 660 497 1156 254 155 protostuff-graph 68 513 655 1168 242 153 java-manual 52 619 588 1207 258 151 wobly-compact 33 702 528 1231 228 143 json-array/fastjson/databind 50 648 701 1349 284 171 json/dsl-json/databind 52 480 878 1358 488 271 protostuff-graph-runtime 56 654 710 1364 244 154 kryo-auto-flat 58 601 808 1409 274 183 smile/jackson/manual 50 686 872 1558 344 252 cbor/jackson/manual 56 696 934 1630 389 245 smile-col/jackson/databind 52 689 962 1651 255 168 cbor-col/jackson/databind 52 682 1000 1682 252 165 msgpack/databind 51 735 983 1718 236 150 protobuf/jackson+afterburner/databind 51 726 1007 1733 242 151 fst-flat 51 751 1031 1782 317 207 msgpack/manual 50 789 1010 1799 236 150 cbor/jackson+afterburner/databind 51 801 1045 1845 398 251 smile/jackson+afterburner/databind 52 811 1053 1864 355 259 kryo-registered 57 1037 894 1931 236 149 json/jackson/manual 52 832 1109 1941 471 262 json-col/jackson/databind 56 783 1164 1947 296 187 flatbuffers 50 1283 810 2093 424 234 smile/jackson/databind 56 848 1273 2121 341 248 protobuf/jackson/databind 53 900 1299 2199 242 151 json/fastjson/databind 51 1014 1190 2203 489 271 jboss-marshalling-river-ct-manual 52 1202 1039 2242 292 171 json/jackson+afterburner/databind 56 958 1299 2257 488 271 json/protostuff-manual 56 1027 1376 2403 452 242 cbor/jackson/databind 57 958 1448 2406 398 251 kryo-auto 51 1250 1220 2470 292 195 avro-generic 291 1597 875 2472 224 136 capnproto 52 1605 919 2525 400 210 fst 52 1294 1257 2551 319 208 json/protostuff-runtime 51 1137 1532 2669 472 252 json/jackson-jr/databind 51 1124 1558 2682 471 263 json/jackson/databind 50 1088 1630 2717 488 271 avro-specific 79 1561 1260 2821 224 136 xml/aalto-manual 57 1596 2119 3715 656 314 jboss-marshalling-river-ct 57 2173 1715 3888 301 203 jboss-marshalling-river-manual 52 1445 3514 4959 486 244 json/gson/manual 51 2349 2787 5136 471 262 xml/woodstox-manual 57 2091 3230 5321 656 314 xml/jackson/databind 51 2095 3826 5921 686 296 hessian 53 2839 3799 6638 504 319 json/gson/databind 52 3725 3247 6971 489 268 json/json-smart/manual-tree 53 3981 3209 7190 498 274 json/gson/manual-tree 51 3930 3980 7911 488 268 xml/fastinfo-manual 51 4476 3825 8301 380 290 bson/mongodb/manual 56 2067 6499 8566 498 286 xml/xstream+c-aalto 51 2902 5904 8806 528 282 xml/javolution/manual 52 4532 5635 10167 507 273 xml/xstream+c-fastinfo 52 4890 5303 10194 348 271 xml/xstream+c-woodstox 52 3428 6962 10390 528 282 jboss-serialization 51 5013 5567 10580 935 587 json/org.json/manual-tree 57 5217 5895 11111 488 268 json/json.simple/manual 51 5214 7058 12272 498 274 json/svenson/databind 52 3272 9671 12943 501 271 json/javax-stream/glassfish 51 4629 8600 13229 471 262 xml/JAXB/aalto 57 3977 9417 13394 705 327 xml/xstream+c 56 4174 10018 14192 490 253 jboss-marshalling-river 52 3217 12756 15972 697 407 json/javax-tree/glassfish 1050 6512 10060 16571 488 273 xml/exi-manual 52 9787 8818 18605 340 331 java-built-in-serializer 58 4188 19294 23482 892 520 java-built-in 52 4375 19577 23952 892 520 stephenerialization 52 4891 19786 24678 1096 522 jboss-marshalling-serial 52 7600 17390 24991 859 503 json/jsonij/manual-jpath 52 16723 8312 25035 484 264 json/flexjson/databind 51 10336 16249 26585 506 282 json/protobuf 237 6077 43021 49098 500 262 json/argo/manual-tree 51 52499 10616 63115 488 273 json/json-lib/databind 51 21409 66142 87551 488 273 xml/JAXB 51 3780 104378 108157 722 338
Effort Format Structure Misc colfer CLASSES_KNOWN BIN_CROSSLANG FLAT_TREE [] generated code kryo-manual MANUAL_OPT BINARY FLAT_TREE [] complete manual optimization protobuf/protostuff CLASSES_KNOWN BIN_CROSSLANG FLAT_TREE [] protobuf + generated code protostuff-manual MANUAL_OPT BINARY FLAT_TREE [] manual protostuff CLASSES_KNOWN BINARY FLAT_TREE [] generated code json-array/dsl-json/databind CLASSES_KNOWN JSON FLAT_TREE [] JSON array format - all properties without names. kryo-opt MANUAL_OPT BINARY FLAT_TREE [] manual optimization kryo-registered-flat CLASSES_KNOWN BINARY FLAT_TREE [] class registration, no references (typical usage) datakernel MANUAL_OPT BINARY FLAT_TREE [] manually optimized protobuf/protostuff-runtime ZERO_KNOWLEDGE BIN_CROSSLANG FLAT_TREE [] protobuf + reflection protostuff-runtime ZERO_KNOWLEDGE BINARY FLAT_TREE [] reflection fst-flat-pre CLASSES_KNOWN BINARY FLAT_TREE [] fst in unshared mode with preregistered classes protobuf CLASSES_KNOWN BIN_CROSSLANG FLAT_TREE [] wobly MANUAL_OPT BINARY FLAT_TREE [] protostuff-graph CLASSES_KNOWN BINARY FULL_GRAPH [] graph + generated code java-manual MANUAL_OPT BINARY FLAT_TREE [] wobly-compact MANUAL_OPT BINARY FLAT_TREE [] json-array/fastjson/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] json/dsl-json/databind CLASSES_KNOWN JSON FLAT_TREE [] Serializes all properties with exact names. protostuff-graph-runtime ZERO_KNOWLEDGE BINARY FULL_GRAPH [] graph + reflection kryo-auto-flat ZERO_KNOWLEDGE BINARY FLAT_TREE [] no class registration, no references smile/jackson/manual MANUAL_OPT BINARY FLAT_TREE [] cbor/jackson/manual MANUAL_OPT BIN_CROSSLANG FLAT_TREE [] smile-col/jackson/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] uses positional (column) layout to eliminate use of names cbor-col/jackson/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] uses positional (column) layout to eliminate use of names msgpack/databind CLASSES_KNOWN BIN_CROSSLANG FLAT_TREE [] uses positional (column) layout (instead of Maps std impl uses) to eliminate use of names protobuf/jackson+afterburner/databind CLASSES_KNOWN BINARY FLAT_TREE [] fst-flat ZERO_KNOWLEDGE BINARY FLAT_TREE [] fst default, but unshared mode msgpack/manual MANUAL_OPT BIN_CROSSLANG FLAT_TREE [] uses positional (column) layout (instead of Maps std impl uses) to eliminate use of names cbor/jackson+afterburner/databind ZERO_KNOWLEDGE BINARY FLAT_TREE [] uses bytecode generation to reduce overhead smile/jackson+afterburner/databind ZERO_KNOWLEDGE BINARY FLAT_TREE [] uses bytecode generation to reduce overhead kryo-registered CLASSES_KNOWN BINARY FULL_GRAPH [] class registration, references (typical usage) json/jackson/manual MANUAL_OPT JSON FLAT_TREE [] json-col/jackson/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] uses positional (column) layout to eliminate use of names flatbuffers CLASSES_KNOWN BIN_CROSSLANG FLAT_TREE [] smile/jackson/databind ZERO_KNOWLEDGE BINARY FLAT_TREE [] protobuf/jackson/databind CLASSES_KNOWN BINARY FLAT_TREE [] json/fastjson/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] jboss-marshalling-river-ct-manual MANUAL_OPT BINARY FULL_GRAPH [] full graph preregistered classes, manual optimization json/jackson+afterburner/databind ZERO_KNOWLEDGE BINARY FLAT_TREE [] uses bytecode generation to reduce overhead json/protostuff-manual MANUAL_OPT JSON FLAT_TREE [] json + manual cbor/jackson/databind ZERO_KNOWLEDGE BIN_CROSSLANG FLAT_TREE [] kryo-auto ZERO_KNOWLEDGE BINARY FULL_GRAPH [] no class registration, references avro-generic MANUAL_OPT BIN_CROSSLANG FLAT_TREE [] capnproto CLASSES_KNOWN BIN_CROSSLANG FLAT_TREE [] fst ZERO_KNOWLEDGE BINARY FULL_GRAPH [] default: JDK serialization drop-in-replacement mode json/protostuff-runtime ZERO_KNOWLEDGE JSON FLAT_TREE [] json + reflection json/jackson-jr/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] json/jackson/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] avro-specific MANUAL_OPT BIN_CROSSLANG UNKNOWN [] xml/aalto-manual MANUAL_OPT XML UNKNOWN [] jboss-marshalling-river-ct CLASSES_KNOWN BINARY FULL_GRAPH [] full graph with preregistered classes jboss-marshalling-river-manual MANUAL_OPT BINARY FULL_GRAPH [] full graph with manual optimizations json/gson/manual MANUAL_OPT JSON FLAT_TREE [] xml/woodstox-manual MANUAL_OPT XML UNKNOWN [] xml/jackson/databind ZERO_KNOWLEDGE XML FLAT_TREE [] hessian ZERO_KNOWLEDGE BIN_CROSSLANG FULL_GRAPH [] json/gson/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] json/json-smart/manual-tree MANUAL_OPT JSON FLAT_TREE [] json/gson/manual-tree MANUAL_OPT JSON FLAT_TREE [] xml/fastinfo-manual MANUAL_OPT XML UNKNOWN [] bson/mongodb/manual MANUAL_OPT BIN_CROSSLANG FLAT_TREE [] xml/xstream+c-aalto MANUAL_OPT XML FLAT_TREE [] xml/javolution/manual MANUAL_OPT XML FLAT_TREE [] xml/xstream+c-fastinfo MANUAL_OPT XML FLAT_TREE [] xml/xstream+c-woodstox MANUAL_OPT XML FLAT_TREE [] jboss-serialization ZERO_KNOWLEDGE BINARY FULL_GRAPH [] json/org.json/manual-tree MANUAL_OPT JSON FLAT_TREE [] json/json.simple/manual MANUAL_OPT JSON FLAT_TREE [] json/svenson/databind MANUAL_OPT JSON FLAT_TREE [] json/javax-stream/glassfish MANUAL_OPT JSON FLAT_TREE [] xml/JAXB/aalto CLASSES_KNOWN XML FULL_GRAPH [] xml/xstream+c ZERO_KNOWLEDGE XML FLAT_TREE [] jboss-marshalling-river ZERO_KNOWLEDGE BINARY FULL_GRAPH [] full graph zero knowledge json/javax-tree/glassfish ZERO_KNOWLEDGE JSON FLAT_TREE [] xml/exi-manual ZERO_KNOWLEDGE XML UNKNOWN [] java-built-in-serializer ZERO_KNOWLEDGE BINARY FULL_GRAPH [] java-built-in ZERO_KNOWLEDGE BINARY FLAT_TREE [] stephenerialization ZERO_KNOWLEDGE BINARY FULL_GRAPH [] null jboss-marshalling-serial ZERO_KNOWLEDGE BINARY FULL_GRAPH [] json/jsonij/manual-jpath MANUAL_OPT JSON FLAT_TREE [] json/flexjson/databind ZERO_KNOWLEDGE JSON FULL_GRAPH [] json/protobuf CLASSES_KNOWN JSON FLAT_TREE [] json/argo/manual-tree MANUAL_OPT JSON FLAT_TREE [] json/json-lib/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] xml/JAXB CLASSES_KNOWN XML FULL_GRAPH []