Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down Expand Up @@ -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 |
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/github/fabienrenaud/jjb/JsonBench.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,7 @@ public Object wast() throws Exception {
return null;
}

public Object djomo() throws Exception {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()`)
Expand Down Expand Up @@ -284,6 +286,11 @@ public JsonSink quickbufSink() {
return QUICKBUF_SINK.get();
}

@Override
public com.bigcloud.djomo.Json djomo() {
return djomo;
}

private static final ThreadLocal<QuickbufSchema.Clients> QUICKBUF_MESSAGE = ThreadLocal.withInitial(QuickbufSchema.Clients::newInstance);
private static final ThreadLocal<JsonSink> QUICKBUF_SINK = ThreadLocal.withInitial(() -> JsonSink.newInstance()
.setPrettyPrinting(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,6 @@ public interface JsonProvider<T> {

JsonSink quickbufSink();

com.bigcloud.djomo.Json djomo();

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public class UsersJsonProvider implements JsonProvider<Users> {
private final JsonType<Users> avajeJsonb_jackson = io.avaje.jsonb.Jsonb.builder().adapter(new JacksonAdapter(/* serializeNulls */ true, /* serializeEmpty */ true, /* failOnUnknown */ false)).build().type(Users.class);
private final JsonType<Users> 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()`)
Expand Down Expand Up @@ -180,6 +182,11 @@ public JsonSink quickbufSink() {
return QUICKBUF_SINK.get();
}

@Override
public com.bigcloud.djomo.Json djomo() {
return djomo;
}

private static final ThreadLocal<QuickbufSchema.Users> QUICKBUF_MESSAGE = ThreadLocal.withInitial(QuickbufSchema.Users::newInstance);
private static final ThreadLocal<JsonSink> QUICKBUF_SINK = ThreadLocal.withInitial(() -> JsonSink.newInstance()
.setPrettyPrinting(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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<Libapi> libapis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public enum Library {
PUREJSON,
ANTONS,
QUICKBUF_JSON,
WAST;
WAST,
DJOMO;

public static Set<Library> fromCsv(String str) {
if (str == null || str.trim().isEmpty()) {
Expand Down