-
Notifications
You must be signed in to change notification settings - Fork 499
eishay_jvm_serializers_benchmark
温绍锦 edited this page Oct 7, 2022
·
5 revisions
OS:Linux
JVM:Oracle Corporation 1.8.0_333
CPU:null os-arch:null
Cores (incl HT):4
Size, Compressed size [light] in bytes
Size, Compressed size [light] in bytes
Size, Compressed size [light] in bytes
Size, Compressed size [light] in bytes
Size, Compressed size [light] in bytes
Size, Compressed size [light] in bytes
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":wiki/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)
Size, Compressed size [light] in bytes
create ser deser total size +dfl jsonb-array/fastjson2/databind 58 364 421 785 227 145 protostuff 73 495 730 1225 242 153 jsonb/fastjson2/databind 57 603 636 1240 366 235 protobuf 265 821 443 1264 242 152 json-array/fastjson2/databind 57 613 731 1344 279 168 kryo-auto-flat 56 732 785 1517 273 184 json/dsl-json/databind 57 603 973 1576 488 271 json/fastjson2/databind 57 708 986 1695 454 247 msgpack/databind 54 822 1128 1950 236 150 thrift-compact 78 1279 701 1980 243 152 thrift 78 1403 691 2094 352 201 json/jackson+afterburner/databind 57 1150 1432 2582 488 271 json/jackson/databind 57 1173 1728 2901 488 271 json-array/fastjson/databind 59 1296 1920 3215 284 171 json/fastjson/databind 59 1806 2014 3819 489 271 json/gson/databind 58 3744 2909 6653 489 268 java-built-in 58 4985 20011 24995 892 520 json/json-lib/databind 58 23863 70802 94665 488 273Contains 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.
Size, Compressed size [light] in bytes
create ser deser total size +dfl kryo-auto 58 1208 1165 2373 291 198Contains 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).
Size, Compressed size [light] in bytes
create ser deser total size +dfl jsonb-array/fastjson2/databind 58 364 421 785 227 145 jsonb/fastjson2/databind 57 603 636 1240 366 235 protobuf 265 821 443 1264 242 152 msgpack/databind 54 822 1128 1950 236 150 thrift-compact 78 1279 701 1980 243 152 thrift 78 1403 691 2094 352 201
- text format based. Usually can be read by anybody. Frequently inline schema inside data.
- Mixed regarding required preparation, object graph awareness (references).
Size, Compressed size [light] in bytes
create ser deser total size +dfl json-array/fastjson2/databind 57 613 731 1344 279 168 json/dsl-json/databind 57 603 973 1576 488 271 json/fastjson2/databind 57 708 986 1695 454 247 json/jackson/databind 57 1173 1728 2901 488 271 json-array/fastjson/databind 59 1296 1920 3215 284 171 json/fastjson/databind 59 1806 2014 3819 489 271 json/gson/databind 58 3744 2909 6653 489 268 json/json-lib/databind 58 23863 70802 94665 488 273all 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
Size, Compressed size [light] in bytes
create ser deser total size +dflshows 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.
Size, Compressed size [light] in bytes
create ser deser total size +dfl protostuff 73 495 730 1225 242 153 msgpack/databind 54 822 1128 1950 236 150
create ser deser total size +dfl jsonb-array/fastjson2/databind 58 364 421 785 227 145 protostuff 73 495 730 1225 242 153 jsonb/fastjson2/databind 57 603 636 1240 366 235 protobuf 265 821 443 1264 242 152 json-array/fastjson2/databind 57 613 731 1344 279 168 kryo-auto-flat 56 732 785 1517 273 184 json/dsl-json/databind 57 603 973 1576 488 271 json/fastjson2/databind 57 708 986 1695 454 247 msgpack/databind 54 822 1128 1950 236 150 thrift-compact 78 1279 701 1980 243 152 thrift 78 1403 691 2094 352 201 kryo-auto 58 1208 1165 2373 291 198 json/jackson+afterburner/databind 57 1150 1432 2582 488 271 json/jackson/databind 57 1173 1728 2901 488 271 json-array/fastjson/databind 59 1296 1920 3215 284 171 json/fastjson/databind 59 1806 2014 3819 489 271 json/gson/databind 58 3744 2909 6653 489 268 java-built-in 58 4985 20011 24995 892 520 json/json-lib/databind 58 23863 70802 94665 488 273
Effort Format Structure Misc jsonb-array/fastjson2/databind ZERO_KNOWLEDGE BIN_CROSSLANG FLAT_TREE [] protostuff CLASSES_KNOWN BINARY FLAT_TREE [] generated code jsonb/fastjson2/databind ZERO_KNOWLEDGE BIN_CROSSLANG FLAT_TREE [] protobuf CLASSES_KNOWN BIN_CROSSLANG FLAT_TREE [] json-array/fastjson2/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] kryo-auto-flat ZERO_KNOWLEDGE BINARY FLAT_TREE [] no class registration, no references json/dsl-json/databind CLASSES_KNOWN JSON FLAT_TREE [] Serializes all properties with exact names. json/fastjson2/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] msgpack/databind CLASSES_KNOWN BIN_CROSSLANG FLAT_TREE [] uses positional (column) layout (instead of Maps std impl uses) to eliminate use of names thrift-compact CLASSES_KNOWN BIN_CROSSLANG FLAT_TREE [] thrift CLASSES_KNOWN BIN_CROSSLANG FLAT_TREE [] kryo-auto ZERO_KNOWLEDGE BINARY FULL_GRAPH [] no class registration, references json/jackson+afterburner/databind ZERO_KNOWLEDGE BINARY FLAT_TREE [] uses bytecode generation to reduce overhead json/jackson/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] json-array/fastjson/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] json/fastjson/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] json/gson/databind ZERO_KNOWLEDGE JSON FLAT_TREE [] java-built-in ZERO_KNOWLEDGE BINARY FLAT_TREE [] json/json-lib/databind ZERO_KNOWLEDGE JSON FLAT_TREE []