java
java copied to clipboard
Benchmark differences
Hi, the jsoniter websites claims it's quite a lot faster compared to Jackson. However as per https://github.com/fabienrenaud/java-json-benchmark -- Jackson seems to be faster in all the test cases. Are there any issues with the benchmark code or settings that need to be applied? Curious to know why there are such differences and which Json library we're currently considering to use.
Thanks.
watching...
@Kyson you can use async-profiler
to get interactive flame graphs that will help to spot weak places easily.
Also, please look into the core module of jsoniter-scala
.
It started from Scala macro that reused reader and writer from Jsoniter Java and generated codecs for them but then evolved to have own core module. Now it has lot of goodies that can be ported back to this library easily:
- parsing and serialization of UUIDs at speed ~70 CPU cycles per value
- serialization of floats and doubles into the most optimal representation using adopted Ryu routines at speed ~120 and ~280 CPU cycles per value accordingly
- parsing and serialization of
java.time.*
classes from/to the ISO-8601 representation without redundant allocation of strings and even without/
and%
operators
@Kyson Also, I have added Jsoniter Java to our benchmark suite using following adapters for parsing and serialization:
https://github.com/plokhotnyuk/jsoniter-scala/blob/master/jsoniter-scala-benchmark/src/main/java/com/jsoniter/input/JsoniterJavaParser.java
https://github.com/plokhotnyuk/jsoniter-scala/blob/master/jsoniter-scala-benchmark/src/main/java/com/jsoniter/output/JsoniterJavaSerializer.java
And it looks quite competitive vs DSL-JSON... Please, see results:
https://plokhotnyuk.github.io/jsoniter-scala/