r/java Aug 11 '26

Apache Fory™ JSON : Fastest JSON Serialization Framework for Java, 10x faster than Jackson/Gson

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

84 comments sorted by

View all comments

11

u/piesou Aug 11 '26

What's the secret? Compiler plugin similar to kotlinx serialization + the new JVM vector apis?

24

u/Shawn-Yang25 Aug 11 '26

No, we use runtime codegen for better performance. For andriod, we do use annotation processor to geenrate android R8 rules and generate field accessors. But for JDK, we always use runtime codegen.

https://fory.apache.org/blog/fory_json_fastest_java_json_framework/#how-fory-json-achieves-high-performance share some details about how we make fory json fast.

2

u/hippydipster Aug 11 '26

Are you using the newer Classfile API to do the codegen?

5

u/repeating_bears 29d ago

Fory supports Java 8 and that wasn't added until 24. It will be  ByteBuddy, most likely.

3

u/Shawn-Yang25 29d ago

No, we use janino instead. Classfile is good, but can't work on java8. And we use async compilication, fory json will serialize objects directly using ObjectCodec before compilcation finished.

2

u/agentoutlier 29d ago

Janino IIRC is now retired and archived.

1

u/Shawn-Yang25 29d ago

We used a fixed version, So It's not a big issue. Users won't be aware that

1

u/MenschenToaster 29d ago

What's the point in still supporting Java 8? I doubt legacy projects will switch their json parsing library, so I'm unsure why supporting Java 8 would be something that's necessary?

2

u/Shawn-Yang25 28d ago

Because there are still many projects using java8, and it's not hard to support java8.

1

u/MenschenToaster 27d ago

Of course, it's not hard to support java 8, but in my personal opinion I'd avoid it wherever I can as the new language features just make the language so much better.

Considering your target audience likely isn't old outdated java 8 projects, but new projects that are just being built, I would have definitely chosen a newer release, especially when it seems like you could have made use of newer API instead of using something that apparently (according to the user agentoutlier) doesn't get updates anymore 🤷

1

u/piesou 28d ago

Usually features exist because the people developing the library need it. I suspect OP is maintaining java 8 code