PageRenderTime 27ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 0ms

/tpc/src/serializers/BenchmarkRunner.java

https://github.com/eishay/jvm-serializers
Java | 132 lines | 82 code | 16 blank | 34 comment | 0 complexity | f6275ad09b545ae279d6cfe16529ad3c MD5 | raw file
  1. package serializers;
  2. import serializers.avro.AvroGeneric;
  3. import serializers.avro.AvroSpecific;
  4. import serializers.capnproto.CapNProto;
  5. import serializers.colfer.Colfer;
  6. import serializers.datakernel.DataKernelSerializer;
  7. import serializers.flatbuffers.FlatBuffers;
  8. import serializers.jackson.*;
  9. import serializers.javaxjson.*;
  10. import serializers.json.*;
  11. import serializers.kryo.Kryo;
  12. import serializers.msgpack.MsgPack;
  13. import serializers.protobuf.Protobuf;
  14. import serializers.protobuf.ProtobufJson;
  15. import serializers.protostuff.Protostuff;
  16. import serializers.protostuff.ProtostuffJson;
  17. import serializers.wobly.Wobly;
  18. import serializers.xml.*;
  19. /**
  20. * Full test of various codecs, using a single <code>MediaItem</code>
  21. * as test data.
  22. */
  23. public class BenchmarkRunner extends MediaItemBenchmark
  24. {
  25. public static void main(String[] args) {
  26. new BenchmarkRunner().runBenchmark(args);
  27. }
  28. @Override
  29. protected void addTests(TestGroups groups)
  30. {
  31. // Binary Formats; language-specific ones
  32. JavaBuiltIn.register(groups);
  33. JavaManual.register(groups);
  34. Stephenerialization.register(groups);
  35. // Scala.register(groups);
  36. // hessian, kryo and wobly are Java object serializations
  37. Hessian.register(groups);
  38. Kryo.register(groups);
  39. FastSerialization.register(groups);
  40. Wobly.register(groups);
  41. JBossSerialization.register(groups);
  42. JBossMarshalling.register(groups);
  43. // 06-May-2013, tatu: Fails on basic Java7, mismatch with Unsafe; commented out
  44. // Obser.register(groups);
  45. // Binary formats, generic: protobuf, thrift, avro, CKS, msgpack, CBOR
  46. Protobuf.register(groups);
  47. // 16-May-2012, Nate: As discussed on mailing list, removed ActiveMQProtobuf as
  48. // its lazy deserialization isn't comparable to other serializers.
  49. // ActiveMQProtobuf.register(groups);
  50. Protostuff.register(groups);
  51. Thrift.register(groups);
  52. AvroSpecific.register(groups);
  53. AvroGeneric.register(groups);
  54. // 01-Oct-2014: MsgPack implementation uses questionable technique as well: instead of using Maps (name/value),
  55. // uses arrays, presumes ordering (and implied schema thereby) -- not inter-operable with most non-Java MsgPack
  56. // usage, and basically seems to optimize for benchmarks instead of reflecting real usage.
  57. MsgPack.register(groups);
  58. JacksonCBORDatabind.register(groups);
  59. JacksonProtobufDatabind.register(groups);
  60. // JSON
  61. JacksonJsonManual.register(groups);
  62. JacksonJsonDatabind.register(groups);
  63. JacksonJrDatabind.register(groups);
  64. // 01-Oct-2014, tatu: not 100% sure this is still needed, but left just in case
  65. // JacksonJsonTree.register(groups);
  66. JavaxJsonTreeGlassfish.register(groups);
  67. JavaxJsonStreamGlassfish.register(groups);
  68. JsonTwoLattes.register(groups);
  69. ProtostuffJson.register(groups);
  70. ProtobufJson.register(groups);
  71. JsonGsonManual.register(groups);
  72. JsonGsonTree.register(groups);
  73. JsonGsonDatabind.register(groups);
  74. JsonSvensonDatabind.register(groups);
  75. FlexjsonDatabind.register(groups);
  76. JsonLibJsonDatabind.register(groups);
  77. FastJSONDatabind.register(groups);
  78. FastJSONArrayDatabind.register(groups);
  79. JsonSimpleWithContentHandler.register(groups);
  80. // JsonSimpleManualTree.register(groups);
  81. JsonSmartManualTree.register(groups);
  82. JsonDotOrgManualTree.register(groups);
  83. JsonijJpath.register(groups);
  84. // JsonijManualTree.register(groups);
  85. JsonArgoTree.register(groups);
  86. // 06-May-2013, tatu: Too slow (100x above fastest)
  87. // JsonPathDeserializerOnly.register(groups);
  88. // Then JSON-like binary variants
  89. // Smile is 1-to-1 binary JSON serialization
  90. JacksonSmileManual.register(groups);
  91. JacksonSmileDatabind.register(groups);
  92. // 06-May-2013, tatu: Unfortunately there is a version conflict
  93. // here too -- commenting out, to let David fix it
  94. // ProtostuffSmile.register(groups);
  95. // BSON is JSON-like format with extended datatypes
  96. MongoDB.register(groups);
  97. // XML-based formats; first textual XML
  98. XmlStax.register(groups, true, true, false); // woodstox/aalto/-
  99. XmlXStream.register(groups);
  100. JacksonXmlDatabind.register(groups);
  101. XmlJavolution.register(groups);
  102. // Then binary XML; Fast Infoset, EXI
  103. XmlStax.register(groups, false, false, true); // -/-/fast-infoset
  104. ExiExificient.register(groups);
  105. // Other things...
  106. // Jackson databind with Afterburner; add-on module that uses bytecode gen for speed
  107. JacksonWithAfterburner.registerAll(groups);
  108. // Jackson's column-oriented variants for formats that usually use key/value notation
  109. JacksonWithColumnsDatabind.registerAll(groups);
  110. serializers.dsljson.DSLJson.register(groups);
  111. FlatBuffers.register(groups);
  112. CapNProto.register(groups);
  113. Colfer.register(groups);
  114. DataKernelSerializer.register(groups);
  115. }
  116. }