eishay / jvm-serializers

Benchmark comparing serialization libraries on the JVM
http://groups.google.com/group/java-serialization-benchmarking
3.28k stars 560 forks source link

Benchmarks for Java Records using java.io.Serializable #88

Open ChrisTrenkamp opened 2 years ago

ChrisTrenkamp commented 2 years ago

https://blogs.oracle.com/javamagazine/post/simpler-object-and-data-serialization-using-java-records

Oracle is claiming ObjectOutputStream/ObjectInputStream have optimizations for Java Records. Can we implement a benchmark to see if Java serialization is any faster with records rather than plain classes?

cakoose commented 2 years ago

I think that would be a valuable addition to the benchmark. Not sure how familiar you are with this codebase, but if you're interested in adding this yourself:

  1. Write the equivalent of the classes in "tpc/src/data/media", except using records. Put them in "tpc/src/serializers/java-records/media".
  2. Create "tpc/src/serializers/java-records/JavaRecordsBuiltIn.java".
    • Start by copying "tpc/src/serializers/JavaBuiltIn.java".
    • Change the forward and reverse methods to convert between the "tpc/src/data/media" types and your new record-based types.
    • Modify the serializer implementation to use your new types.

One thing that might concern people is the dependency on Java 16. But I dunno, maybe it's fine?