r/scala • • Aug 11 '26

Apache Fory™ JSON: 10x Faster JSON Serialization Framework for Java

https://fory.apache.org/blog/fory_json_fastest_java_json_framework

Apache Fory JSON is a high-performance JSON serialization framework for Java. It maps Java objects to and from standard JSON text and UTF-8 bytes.

In the published benchmarks, it reaches up to 10.91× Jackson’s throughput and 10.89× Gson’s in java-json-benchmark, and up to 5.55× and 10.00× respectively in the jvm-serializers MediaContent benchmark.

It supports JDK 8+, Android, and GraalVM Native Image. JDK17+ Record is also supported.

32 Upvotes

8 comments sorted by

17

u/kag0 Aug 12 '26

How does it compare to Scala JSON libraries? Would be interesting to get it on the jsoniter benchmark page https://plokhotnyuk.github.io/jsoniter-scala/

3

u/Shawn-Yang25 Aug 12 '26

Fory is still faster than jsoniter-scala on jvm-serializers MediaContent benchmark, https://github.com/chaokunyang/scala-json-benchmarks is detailed code, here is summary:

RepresentationOperationFory JSON ops/secjsoniter-scala ops/secJackson Scala ops/sec
StringSerialize7,000,8553,924,9962,252,244
StringDeserialize3,158,7542,309,9061,004,262
UTF-8 bytesSerialize9,672,2191,965,7832,052,409
UTF-8 bytesDeserialize3,136,9832,357,2071,198,119

RepresentationOperationvs jsoniter-scalavs Jackson Scala
StringSerialize1.78x3.11x
StringDeserialize1.37x3.15x
UTF-8 bytesSerialize4.92x4.71x
UTF-8 bytesDeserialize1.33x2.62x

2

u/Shawn-Yang25 Aug 12 '26

I have not run jsoniter-scala benchmark, that's lots of work, maybe run it when I have time.

3

u/Doikor Aug 13 '26

I think you should add blackholes into those benchmarks. It is possible now that the JIT just decides to not do the work in some cases.

https://github.com/sbt/sbt-jmh/blob/main/plugin/src/sbt-test/sbt-jmh/run/src/main/scala/org/openjdk/jmh/samples/JMHSample_09_Blackholes.scala#L84-L88

11

u/LargeDietCokeNoIce Aug 12 '26

Agree. Jsoniter is hands down the fastest Scala json serializer today. It would be very hard to beat: uses macros to generate what amounts to optimized hand-tooled serialization code. If you can beat that you have some powerful magic

1

u/Reeebuuk Aug 12 '26

I’ve tested it a little bit but it seems jaoniter is 20x faster for json -> scala -> json and 2x for json -> java -> json (ofc jsoniter produced scala in this case).

1

u/dh44t Aug 13 '26

Maybe there is hope for a faster Avro serialisation library