diff --git a/README.md b/README.md index 153b36e..6ca669b 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ It covers the following libraries: * [avaje-jsonb](https://github.com/avaje/avaje-jsonb) * [boon](https://github.com/boonproject/boon) +* [djomo](https://github.com/alexvigdor/djomo-core) * [dsl-json](https://github.com/ngs-doo/dsl-json) * [fastjson](https://github.com/alibaba/fastjson) * [flexjson](http://flexjson.sourceforge.net/) @@ -60,6 +61,7 @@ The results here-below were computed on January the 30th, 2024 with the followin |--------------|----------| | avaje-jsonb | 1.9 | | boon | 0.34 | +| djomo | 0.9.4 | | dsl-json | 1.10.0 | | fastjson | 2.0.46 | | flexjson | 3.3 | diff --git a/build.gradle b/build.gradle index 7072a82..5d229bd 100644 --- a/build.gradle +++ b/build.gradle @@ -106,6 +106,8 @@ dependencies { implementation 'us.hebi.quickbuf:quickbuf-runtime:1.4' // wast implementation 'io.github.wycst:wast:0.0.26' + // djomo + implementation 'com.bigcloud.djomo:djomo:0.9.4' // Test testImplementation 'junit:junit:4.13.2' diff --git a/src/main/java/com/github/fabienrenaud/jjb/JsonBench.java b/src/main/java/com/github/fabienrenaud/jjb/JsonBench.java index c4e8fc9..5b31c80 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/JsonBench.java +++ b/src/main/java/com/github/fabienrenaud/jjb/JsonBench.java @@ -149,4 +149,7 @@ public Object wast() throws Exception { return null; } + public Object djomo() throws Exception { + return null; + } } diff --git a/src/main/java/com/github/fabienrenaud/jjb/databind/Deserialization.java b/src/main/java/com/github/fabienrenaud/jjb/databind/Deserialization.java index c8567e9..c31bdc3 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/databind/Deserialization.java +++ b/src/main/java/com/github/fabienrenaud/jjb/databind/Deserialization.java @@ -155,4 +155,10 @@ public Object quickbuf_json() throws Exception { public Object wast() throws Exception { return io.github.wycst.wast.json.JSON.parseObject(JSON_SOURCE().nextString(), JSON_SOURCE().pojoType()); } + + @Benchmark + @Override + public Object djomo() throws Exception { + return JSON_SOURCE().provider().djomo().fromString(JSON_SOURCE().nextString(), JSON_SOURCE().pojoType()); + } } diff --git a/src/main/java/com/github/fabienrenaud/jjb/databind/Serialization.java b/src/main/java/com/github/fabienrenaud/jjb/databind/Serialization.java index 89738b4..46303c7 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/databind/Serialization.java +++ b/src/main/java/com/github/fabienrenaud/jjb/databind/Serialization.java @@ -190,4 +190,12 @@ public Object wast() throws Exception { io.github.wycst.wast.json.JSON.writeJsonTo(JSON_SOURCE().nextPojo(), baos); return baos; } + + @Benchmark + @Override + public Object djomo() throws Exception { + ByteArrayOutputStream baos = JsonUtils.byteArrayOutputStream(); + JSON_SOURCE().provider().djomo().write(JSON_SOURCE().nextPojo(), baos); + return baos; + } } diff --git a/src/main/java/com/github/fabienrenaud/jjb/provider/ClientsJsonProvider.java b/src/main/java/com/github/fabienrenaud/jjb/provider/ClientsJsonProvider.java index 6d5178f..6292e78 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/provider/ClientsJsonProvider.java +++ b/src/main/java/com/github/fabienrenaud/jjb/provider/ClientsJsonProvider.java @@ -160,6 +160,8 @@ public void toJson(com.squareup.moshi.JsonWriter writer, @Nullable OffsetDateTim .builder() .adapter(new JsonStream(/* serializeNulls */ true, /* serializeEmpty */ true, /* failOnUnknown */ false)).build().type(Clients.class); + private final com.bigcloud.djomo.Json djomo = new com.bigcloud.djomo.Json(); + public ClientsJsonProvider() { // set johnzon JsonReader (default is `JsonProvider.provider()`) @@ -284,6 +286,11 @@ public JsonSink quickbufSink() { return QUICKBUF_SINK.get(); } + @Override + public com.bigcloud.djomo.Json djomo() { + return djomo; + } + private static final ThreadLocal QUICKBUF_MESSAGE = ThreadLocal.withInitial(QuickbufSchema.Clients::newInstance); private static final ThreadLocal QUICKBUF_SINK = ThreadLocal.withInitial(() -> JsonSink.newInstance() .setPrettyPrinting(false) diff --git a/src/main/java/com/github/fabienrenaud/jjb/provider/JsonProvider.java b/src/main/java/com/github/fabienrenaud/jjb/provider/JsonProvider.java index c729244..df9d4f2 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/provider/JsonProvider.java +++ b/src/main/java/com/github/fabienrenaud/jjb/provider/JsonProvider.java @@ -60,4 +60,6 @@ public interface JsonProvider { JsonSink quickbufSink(); + com.bigcloud.djomo.Json djomo(); + } diff --git a/src/main/java/com/github/fabienrenaud/jjb/provider/UsersJsonProvider.java b/src/main/java/com/github/fabienrenaud/jjb/provider/UsersJsonProvider.java index 00af287..0c4eca5 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/provider/UsersJsonProvider.java +++ b/src/main/java/com/github/fabienrenaud/jjb/provider/UsersJsonProvider.java @@ -56,6 +56,8 @@ public class UsersJsonProvider implements JsonProvider { private final JsonType avajeJsonb_jackson = io.avaje.jsonb.Jsonb.builder().adapter(new JacksonAdapter(/* serializeNulls */ true, /* serializeEmpty */ true, /* failOnUnknown */ false)).build().type(Users.class); private final JsonType avajeJsonb_default = io.avaje.jsonb.Jsonb.builder().adapter(new JsonStream(/* serializeNulls */ true, /* serializeEmpty */ true, /* failOnUnknown */ false)).build().type(Users.class); + private final com.bigcloud.djomo.Json djomo = new com.bigcloud.djomo.Json(); + public UsersJsonProvider() { // set johnzon JsonReader (default is `JsonProvider.provider()`) @@ -180,6 +182,11 @@ public JsonSink quickbufSink() { return QUICKBUF_SINK.get(); } + @Override + public com.bigcloud.djomo.Json djomo() { + return djomo; + } + private static final ThreadLocal QUICKBUF_MESSAGE = ThreadLocal.withInitial(QuickbufSchema.Users::newInstance); private static final ThreadLocal QUICKBUF_SINK = ThreadLocal.withInitial(() -> JsonSink.newInstance() .setPrettyPrinting(false) diff --git a/src/main/java/com/github/fabienrenaud/jjb/support/BenchSupport.java b/src/main/java/com/github/fabienrenaud/jjb/support/BenchSupport.java index d85d75b..85922c7 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/support/BenchSupport.java +++ b/src/main/java/com/github/fabienrenaud/jjb/support/BenchSupport.java @@ -38,7 +38,8 @@ public enum BenchSupport { new Libapi(Library.PUREJSON, Api.STREAM), new Libapi(Library.ANTONS, Api.STREAM), new Libapi(Library.QUICKBUF_JSON, Api.DATABIND), - new Libapi(Library.WAST, Api.DATABIND) + new Libapi(Library.WAST, Api.DATABIND), + new Libapi(Library.DJOMO, Api.DATABIND) ), CLIENTS( new Libapi(Library.GSON, Api.DATABIND), @@ -68,7 +69,8 @@ public enum BenchSupport { new Libapi(Library.TAPESTRY), new Libapi(Library.MINIMALJSON), new Libapi(Library.UNDERSCORE_JAVA), - new Libapi(Library.ANTONS) + new Libapi(Library.ANTONS), + new Libapi(Library.DJOMO, Api.DATABIND) ); private final List libapis; diff --git a/src/main/java/com/github/fabienrenaud/jjb/support/Library.java b/src/main/java/com/github/fabienrenaud/jjb/support/Library.java index 7f61f57..2584454 100644 --- a/src/main/java/com/github/fabienrenaud/jjb/support/Library.java +++ b/src/main/java/com/github/fabienrenaud/jjb/support/Library.java @@ -36,7 +36,8 @@ public enum Library { PUREJSON, ANTONS, QUICKBUF_JSON, - WAST; + WAST, + DJOMO; public static Set fromCsv(String str) { if (str == null || str.trim().isEmpty()) {