PageRenderTime 69ms CodeModel.GetById 38ms RepoModel.GetById 1ms app.codeStats 0ms

/tpc/src/serializers/BenchmarkRunner.java

https://github.com/maslovalex/jvm-serializers
Java | 122 lines | 98 code | 11 blank | 13 comment | 0 complexity | 08dd148888d5749e92a14d202325018b MD5 | raw file
  1. package serializers;
  2. import java.io.*;
  3. import java.net.URLEncoder;
  4. import java.util.*;
  5. import java.util.regex.Pattern;
  6. import java.util.zip.DeflaterOutputStream;
  7. import serializers.BenchmarkBase.Params;
  8. import serializers.cks.CksBinary;
  9. import serializers.cks.CksText;
  10. import serializers.jackson.*;
  11. import serializers.json.JsonGsonDatabind;
  12. import serializers.json.JsonArgoTree;
  13. import serializers.json.FastJSONDatabind;
  14. import serializers.json.FlexjsonDatabind;
  15. import serializers.json.JsonGsonManual;
  16. import serializers.json.JsonGsonTree;
  17. import serializers.json.JsonDotOrgManualTree;
  18. import serializers.json.JsonLibJsonDatabind;
  19. import serializers.json.JsonPathDeserializerOnly;
  20. import serializers.json.JsonSimpleManualTree;
  21. import serializers.json.JsonSimpleWithContentHandler;
  22. import serializers.json.JsonSmartManualTree;
  23. import serializers.json.JsonTwoLattes;
  24. import serializers.json.JsonijJpath;
  25. import serializers.json.JsonijManualTree;
  26. import serializers.json.JsonSvensonDatabind;
  27. import serializers.protobuf.ActiveMQProtobuf;
  28. import serializers.protobuf.Protobuf;
  29. import serializers.protostuff.Protostuff;
  30. import serializers.protostuff.ProtostuffJson;
  31. import serializers.protostuff.ProtostuffSmile;
  32. import serializers.xml.XmlJavolution;
  33. import serializers.xml.XmlStax;
  34. import serializers.xml.XmlXStream;
  35. public class BenchmarkRunner extends MediaItemBenchmark
  36. {
  37. public static void main(String[] args) {
  38. new BenchmarkRunner().runBenchmark(args);
  39. }
  40. @Override
  41. protected void addTests(TestGroups groups)
  42. {
  43. // Binary Formats; language-specific ones
  44. JavaBuiltIn.register(groups);
  45. JavaManual.register(groups);
  46. Scala.register(groups);
  47. // hessian, kryo and wobly are Java object serializations
  48. Hessian.register(groups);
  49. Kryo.register(groups);
  50. Wobly.register(groups);
  51. // Binary formats, generic: protobuf, thrift, avro, CKS, msgpack
  52. Protobuf.register(groups);
  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. MsgPack.register(groups);
  60. // JSON
  61. JacksonJsonManual.register(groups);
  62. JacksonJsonDatabind.register(groups);
  63. JacksonJsonDatabindWithStrings.register(groups);
  64. JacksonJsonAfterburner.register(groups); // databind with bytecode generation (faster)
  65. JacksonJsonTree.register(groups);
  66. JacksonJsonTreeWithStrings.register(groups);
  67. JsonTwoLattes.register(groups);
  68. ProtostuffJson.register(groups);
  69. // too slow, why bother:
  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. JsonSimpleWithContentHandler.register(groups);
  79. JsonSimpleManualTree.register(groups);
  80. JsonSmartManualTree.register(groups);
  81. JsonDotOrgManualTree.register(groups);
  82. JsonijJpath.register(groups);
  83. JsonijManualTree.register(groups);
  84. JsonArgoTree.register(groups);
  85. JsonPathDeserializerOnly.register(groups);
  86. // Then JSON-like
  87. // CKS text is textual JSON-like format
  88. CksText.register(groups);
  89. // then binary variants
  90. // Smile is 1-to-1 binary JSON serialization
  91. JacksonSmileManual.register(groups);
  92. JacksonSmileDatabind.register(groups);
  93. JacksonSmileAfterburner.register(groups); // databind with bytecode generation (faster)
  94. ProtostuffSmile.register(groups);
  95. // BSON is JSON-like format with extended datatypes
  96. JacksonBsonDatabind.register(groups);
  97. MongoDB.register(groups);
  98. // XML-based formats.
  99. XmlStax.register(groups, true, true, true); // woodstox/aalto/fast-infoset
  100. XmlXStream.register(groups);
  101. JacksonXmlDatabind.register(groups);
  102. XmlJavolution.register(groups);
  103. // Yaml
  104. SnakeYaml.register(groups);
  105. SnakeYamlShared.register(groups);
  106. Jvyaml.register(groups);
  107. Jvyamlb.register(groups);
  108. YamlBeans.register(groups);
  109. JYaml.register(groups);
  110. }
  111. }