PageRenderTime 5540ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/tpc/src/serializers/BenchmarkRunner.java

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