Skip to content
RuedigerMoeller edited this page Mar 13, 2014 · 76 revisions

Test Platform
OS:Windows 8
JVM:Oracle Corporation 1.7.0_51
CPU:Intel64 Family 6 Model 58 Stepping 9, GenuineIntel os-arch:AMD64
Cores (incl HT):8

Disclamer

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.

Serializers (no shared refs)

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 [light] in bytes

                                   create     ser   deser   total   size  +dfl
protostuff                             97     562     833    1395    239   150
fst-flat-pre                           74     749     854    1603    251   165
kryo-flat-pre                          75     746    1036    1781    212   132
protobuf                              150    1418     833    2251    239   149
msgpack-databind                       75     979    1606    2585    233   146
json/fastjson/databind                 75    1443    1341    2784    486   262
thrift-compact                        147    1704    1082    2785    240   148
thrift                                148    2014    1065    3079    349   197
scala/sbinary                         145    1844    1283    3127    255   147
smile/jackson/db-afterburner           74    1619    1655    3274    352   252
smile/jackson/databind                 74    1798    2086    3884    338   241
json/jackson/db-afterburner            74    1726    2462    4187    485   261
json/protostuff-runtime                74    1754    2476    4231    469   243
json/jackson/databind                  76    1904    2993    4897    485   261
xml/jackson/databind-aalto             75    3217    6140    9357    683   286
json/google-gson/databind              75    6377    5476   11853    486   259
bson/jackson/databind                  75    6450    7567   14017    506   286
xml/xstream+c                          75    7023   15139   22162    487   244
json/javax-tree/glassfish            1458   10823   13887   24710    485   263
xml/exi-manual                         74   18133   16073   34206    337   327
java-built-in                          89    6304   35033   41337    889   514
scala/java-built-in                   145    9727   54939   64666   1312   700
json/protobuf                         153    9816   62385   72201    488   253
json/json-lib-databind                 74   29087  133220  162307    485   263

Full Object Graph Serializers

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 [light] in bytes

                                   create     ser   deser   total   size  +dfl
fst                                    74    1621    1648    3269    316   203
kryo-serializer                        74    1928    1620    3547    286   188
jboss-marshalling-river-ct             77    3666    2586    6252    298   199
hessian                                75    4144    7204   11348    501   313
jboss-serialization                    75    7276    7276   14552    932   582
jboss-marshalling-river                74    5283   29500   34783    694   400
java-built-in-serializer               74    6443   34649   41091    889   514
jboss-marshalling-serial               74   13334   37781   51115    856   498
json/flexjson/databind                 74   21633   30977   52610    503   273
yaml/jackson                           75   22793   34857   57650    505   260

Cross Lang Binary Serializers

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 [light] in bytes

                                   create     ser   deser   total   size  +dfl
protobuf/protostuff                    97     601     838    1439    239   149
protobuf                              150    1418     833    2251    239   149
msgpack-databind                       75     979    1606    2585    233   146
thrift-compact                        147    1704    1082    2785    240   148
thrift                                148    2014    1065    3079    349   197
hessian                                75    4144    7204   11348    501   313
bson/jackson/databind                  75    6450    7567   14017    506   286

XML/JSon Serializers

  • 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 [light] in bytes

                                   create     ser   deser   total   size  +dfl
json/fastjson/databind                 75    1443    1341    2784    486   262
smile/jackson/db-afterburner           74    1619    1655    3274    352   252
json/jackson/db-afterburner            74    1726    2462    4187    485   261
json/protostuff-runtime                74    1754    2476    4231    469   243
json/jackson/databind                  76    1904    2993    4897    485   261
xml/jackson/databind-aalto             75    3217    6140    9357    683   286
json/google-gson/databind              75    6377    5476   11853    486   259
xml/xstream+c                          75    7023   15139   22162    487   244
json/javax-tree/glassfish            1458   10823   13887   24710    485   263
xml/exi-manual                         74   18133   16073   34206    337   327
json/flexjson/databind                 74   21633   30977   52610    503   273
yaml/jackson                           75   22793   34857   57650    505   260
json/protobuf                         153    9816   62385   72201    488   253
json/json-lib-databind                 74   29087  133220  162307    485   263

Manually optimized Serializers

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 [light] in bytes

                                   create     ser   deser   total   size  +dfl
protostuff-manual                      74     509     815    1324    239   150
kryo-manual                            75     628     717    1345    211   131
wobly                                  54    1028     613    1641    251   151
java-manual                            73     966     729    1695    255   147
kryo-opt                               74     733     978    1711    209   129
wobly-compact                          54    1054     662    1716    225   139
smile/jackson/manual                   74    1022    1262    2284    341   244
msgpack-manual                         75    1010    1512    2521    233   146
json/jackson/manual                    75    1193    1865    3058    468   253
jboss-marshalling-river-ct-manual      74    1884    1379    3263    289   167
avro-generic                          443    2075    1336    3410    221   133
avro-specific                         105    1809    1635    3444    221   133
json/protostuff-manual                 74    1464    2295    3759    449   233
xml/aalto-manual                       75    2297    3416    5713    653   304
jboss-marshalling-river-manual         75    2512    5825    8338    483   240
json/google-gson/manual                75    4107    4344    8451    468   253
xml/woodstox-manual                    74    3412    5597    9009    653   304
json/json-smart/manual/tree            75    6298    4666   10964    495   269
json/google-gson/manual/tree           74    5977    6373   12350    485   259
bson/mongodb                           75    3965    8731   12696    495   278
xml/javolution                         75    6121    9849   15970    504   263
json/json.simple/manual                74    7256    9564   16820    495   269
xml/xstream+c-aalto                    75    5260   11814   17074    525   273
json/org.json/manual/tree              75    7977    9734   17711    485   259
json/svenson-databind                  75    5871   12358   18229    495   269
xml/xstream+c-fastinfo                 74    9256    9657   18913    345   264
xml/xstream+c-woodstox                 74    6141   13349   19490    525   273
json/javax-stream/glassfish            75    7368   12442   19810    468   253
json/jsonij-jpath                      74   47032   15073   62105    478   259
json/argo-manual/tree                  76   72106   16992   89099    485   263

Cost of features

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 [light] in bytes

                                   create     ser   deser   total   size  +dfl
kryo-manual                            75     628     717    1345    211   131
protostuff                             97     562     833    1395    239   150
fst-flat-pre                           74     749     854    1603    251   165
protostuff-runtime                     74     731     971    1701    241   151
kryo-flat-pre                          75     746    1036    1781    212   132
fst-flat                               74     933    1206    2139    314   204
kryo-flat                              75     995    1249    2243    268   177
msgpack-manual                         75    1010    1512    2521    233   146
msgpack-databind                       75     979    1606    2585    233   146
fst                                    74    1621    1648    3269    316   203
kryo-serializer                        74    1928    1620    3547    286   188

Full data

                                   create     ser   deser   total   size  +dfl
protostuff-manual                      74     509     815    1324    239   150
kryo-manual                            75     628     717    1345    211   131
protostuff                             97     562     833    1395    239   150
protobuf/protostuff                    97     601     838    1439    239   149
fst-flat-pre                           74     749     854    1603    251   165
wobly                                  54    1028     613    1641    251   151
java-manual                            73     966     729    1695    255   147
protostuff-runtime                     74     731     971    1701    241   151
kryo-opt                               74     733     978    1711    209   129
wobly-compact                          54    1054     662    1716    225   139
kryo-flat-pre                          75     746    1036    1781    212   132
protobuf/protostuff-runtime            74     888     996    1884    241   150
fst-flat                               74     933    1206    2139    314   204
kryo-flat                              75     995    1249    2243    268   177
protobuf                              150    1418     833    2251    239   149
smile/jackson/manual                   74    1022    1262    2284    341   244
msgpack-manual                         75    1010    1512    2521    233   146
msgpack-databind                       75     979    1606    2585    233   146
json/fastjson/databind                 75    1443    1341    2784    486   262
thrift-compact                        147    1704    1082    2785    240   148
json/jackson/manual                    75    1193    1865    3058    468   253
thrift                                148    2014    1065    3079    349   197
scala/sbinary                         145    1844    1283    3127    255   147
jboss-marshalling-river-ct-manual      74    1884    1379    3263    289   167
fst                                    74    1621    1648    3269    316   203
smile/jackson/db-afterburner           74    1619    1655    3274    352   252
avro-generic                          443    2075    1336    3410    221   133
avro-specific                         105    1809    1635    3444    221   133
kryo-serializer                        74    1928    1620    3547    286   188
json/protostuff-manual                 74    1464    2295    3759    449   233
smile/jackson/databind                 74    1798    2086    3884    338   241
json/jackson/db-afterburner            74    1726    2462    4187    485   261
json/protostuff-runtime                74    1754    2476    4231    469   243
json/jackson/databind                  76    1904    2993    4897    485   261
xml/aalto-manual                       75    2297    3416    5713    653   304
jboss-marshalling-river-ct             77    3666    2586    6252    298   199
jboss-marshalling-river-manual         75    2512    5825    8338    483   240
json/google-gson/manual                75    4107    4344    8451    468   253
xml/woodstox-manual                    74    3412    5597    9009    653   304
xml/jackson/databind-aalto             75    3217    6140    9357    683   286
json/json-smart/manual/tree            75    6298    4666   10964    495   269
hessian                                75    4144    7204   11348    501   313
json/google-gson/databind              75    6377    5476   11853    486   259
json/google-gson/manual/tree           74    5977    6373   12350    485   259
bson/mongodb                           75    3965    8731   12696    495   278
bson/jackson/databind                  75    6450    7567   14017    506   286
jboss-serialization                    75    7276    7276   14552    932   582
xml/javolution                         75    6121    9849   15970    504   263
json/json.simple/manual                74    7256    9564   16820    495   269
xml/xstream+c-aalto                    75    5260   11814   17074    525   273
json/org.json/manual/tree              75    7977    9734   17711    485   259
json/svenson-databind                  75    5871   12358   18229    495   269
xml/xstream+c-fastinfo                 74    9256    9657   18913    345   264
xml/xstream+c-woodstox                 74    6141   13349   19490    525   273
json/javax-stream/glassfish            75    7368   12442   19810    468   253
xml/xstream+c                          75    7023   15139   22162    487   244
json/javax-tree/glassfish            1458   10823   13887   24710    485   263
xml/exi-manual                         74   18133   16073   34206    337   327
jboss-marshalling-river                74    5283   29500   34783    694   400
java-built-in-serializer               74    6443   34649   41091    889   514
java-built-in                          89    6304   35033   41337    889   514
jboss-marshalling-serial               74   13334   37781   51115    856   498
json/flexjson/databind                 74   21633   30977   52610    503   273
yaml/jackson                           75   22793   34857   57650    505   260
json/jsonij-jpath                      74   47032   15073   62105    478   259
scala/java-built-in                   145    9727   54939   64666   1312   700
json/protobuf                         153    9816   62385   72201    488   253
json/argo-manual/tree                  76   72106   16992   89099    485   263
json/json-lib-databind                 74   29087  133220  162307    485   263
                                   Effort          Format         Structure  Misc
protostuff-manual                  MANUAL_OPT      BINARY         FLAT_TREE  []                                                          
kryo-manual                        MANUAL_OPT      BINARY         FLAT_TREE  [] manually optimized                                       
protostuff                         CLASSES_KNOWN   BINARY         FLAT_TREE  [] generated code                                           
protobuf/protostuff                CLASSES_KNOWN   BIN_CROSSLANG  FLAT_TREE  [] protobuf serialization + generated code                  
fst-flat-pre                       CLASSES_KNOWN   BINARY         FLAT_TREE  [] fst in unshared mode with preregistered classes          
wobly                              MANUAL_OPT      BINARY         FLAT_TREE  []                                                          
java-manual                        MANUAL_OPT      BINARY         FLAT_TREE  []                                                          
protostuff-runtime                 CLASSES_KNOWN   BINARY         FLAT_TREE  []                                                          
kryo-opt                           MANUAL_OPT      BINARY         FLAT_TREE  [] manually optimized                                       
wobly-compact                      MANUAL_OPT      BINARY         FLAT_TREE  []                                                          
kryo-flat-pre                      CLASSES_KNOWN   BINARY         FLAT_TREE  [] no shared refs, preregistered classes                    
protobuf/protostuff-runtime        ZERO_KNOWLEDGE  BINARY         FLAT_TREE  []                                                          
fst-flat                           ZERO_KNOWLEDGE  BINARY         FLAT_TREE  [] fst default, but unshared mode                           
kryo-flat                          ZERO_KNOWLEDGE  BINARY         FLAT_TREE  [] default, no shared refs                                  
protobuf                           CLASSES_KNOWN   BIN_CROSSLANG  FLAT_TREE  []                                                          
smile/jackson/manual               MANUAL_OPT      JSON           FLAT_TREE  []                                                          
msgpack-manual                     MANUAL_OPT      BIN_CROSSLANG  FLAT_TREE  []                                                          
msgpack-databind                   CLASSES_KNOWN   BIN_CROSSLANG  FLAT_TREE  []                                                          
json/fastjson/databind             ZERO_KNOWLEDGE  JSON           FLAT_TREE  []                                                          
thrift-compact                     CLASSES_KNOWN   BIN_CROSSLANG  FLAT_TREE  []                                                          
json/jackson/manual                MANUAL_OPT      JSON           FLAT_TREE  []                                                          
thrift                             CLASSES_KNOWN   BIN_CROSSLANG  FLAT_TREE  []                                                          
scala/sbinary                      MISC            MISC           UNKNOWN    [] null                                                     
jboss-marshalling-river-ct-manual  MANUAL_OPT      BINARY         FULL_GRAPH [] full graph preregistered classes, manual optimization    
fst                                ZERO_KNOWLEDGE  BINARY         FULL_GRAPH [] default: JDK serialization drop-in-replacement mode      
smile/jackson/db-afterburner       ZERO_KNOWLEDGE  JSON           FLAT_TREE  []                                                          
avro-generic                       MANUAL_OPT      BIN_CROSSLANG  FLAT_TREE  []                                                          
avro-specific                      MANUAL_OPT      BIN_CROSSLANG  UNKNOWN    []                                                          
kryo-serializer                    ZERO_KNOWLEDGE  BINARY         FULL_GRAPH [] default                                                  
json/protostuff-manual             MANUAL_OPT      JSON           FLAT_TREE  []                                                          
smile/jackson/databind             ZERO_KNOWLEDGE  BINARY         FLAT_TREE  []                                                          
json/jackson/db-afterburner        ZERO_KNOWLEDGE  JSON           FLAT_TREE  [] uses bytecode generation to reduce overhead              
json/protostuff-runtime            ZERO_KNOWLEDGE  JSON           FLAT_TREE  []                                                          
json/jackson/databind              ZERO_KNOWLEDGE  JSON           FLAT_TREE  []                                                          
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/google-gson/manual            MANUAL_OPT      JSON           FLAT_TREE  []                                                          
xml/woodstox-manual                MANUAL_OPT      XML            UNKNOWN    []                                                          
xml/jackson/databind-aalto         ZERO_KNOWLEDGE  XML            FLAT_TREE  []                                                          
json/json-smart/manual/tree        MANUAL_OPT      JSON           FLAT_TREE  []                                                          
hessian                            ZERO_KNOWLEDGE  BIN_CROSSLANG  FULL_GRAPH []                                                          
json/google-gson/databind          ZERO_KNOWLEDGE  JSON           FLAT_TREE  []                                                          
json/google-gson/manual/tree       MANUAL_OPT      JSON           FLAT_TREE  []                                                          
bson/mongodb                       MANUAL_OPT      BIN_CROSSLANG  FLAT_TREE  []                                                          
bson/jackson/databind              CLASSES_KNOWN   BIN_CROSSLANG  FLAT_TREE  []                                                          
jboss-serialization                ZERO_KNOWLEDGE  BINARY         FULL_GRAPH []                                                          
xml/javolution                     MANUAL_OPT      XML            FLAT_TREE  []                                                          
json/json.simple/manual            MANUAL_OPT      JSON           FLAT_TREE  []                                                          
xml/xstream+c-aalto                MANUAL_OPT      XML            FLAT_TREE  []                                                          
json/org.json/manual/tree          MANUAL_OPT      JSON           FLAT_TREE  []                                                          
json/svenson-databind              MANUAL_OPT      JSON           FLAT_TREE  []                                                          
xml/xstream+c-fastinfo             MANUAL_OPT      XML            FLAT_TREE  []                                                          
xml/xstream+c-woodstox             MANUAL_OPT      XML            FLAT_TREE  []                                                          
json/javax-stream/glassfish        MANUAL_OPT      JSON           FLAT_TREE  []                                                          
xml/xstream+c                      ZERO_KNOWLEDGE  XML            FLAT_TREE  []                                                          
json/javax-tree/glassfish          ZERO_KNOWLEDGE  JSON           FLAT_TREE  []                                                          
xml/exi-manual                     ZERO_KNOWLEDGE  XML            UNKNOWN    []                                                          
jboss-marshalling-river            ZERO_KNOWLEDGE  BINARY         FULL_GRAPH [] full graph zero knowledge                                
java-built-in-serializer           ZERO_KNOWLEDGE  BINARY         FULL_GRAPH []                                                          
java-built-in                      ZERO_KNOWLEDGE  BINARY         FLAT_TREE  []                                                          
jboss-marshalling-serial           ZERO_KNOWLEDGE  BINARY         FULL_GRAPH []                                                          
json/flexjson/databind             ZERO_KNOWLEDGE  JSON           FULL_GRAPH []                                                          
yaml/jackson                       ZERO_KNOWLEDGE  JSON           FULL_GRAPH []                                                          
json/jsonij-jpath                  MANUAL_OPT      JSON           FLAT_TREE  []                                                          
scala/java-built-in                MISC            MISC           UNKNOWN    [] null                                                     
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  []