Fury 0.4.0 released: Graalvm native image and c++ encoder support

Shawn.Yang
3 min readDec 3, 2023

--

I’m pleased to announce the 0.4.0 release of the Fury: https://github.com/alipay/fury/releases/tag/v0.4.0 . With this release, GraalVM native image and C++ row format automatic encoder based on compile-time reflection are supported. Please try it out and share your feedbacks with us.

Highlight

  • [Java] Support Graalvm native image. The implementation will generate all serialization code at image build time, the runtime will be extremely fast, see fury graalvm usage doc
  • [Java] Fury vs JDK benchmark on Graalvm native image
  • [Scala] Serialization support for package scoped object
  • [C++] Reflection support by macro/template programing
  • [C++] Automatic row format encoder

GraalVM Native Image Example

import io.fury.Fury;
import io.fury.util.Preconditions;

import java.util.List;
import java.util.Map;

public class Example {
public record Record (
int f1,
String f2,
List<String> f3,
Map<String, Long> f4) {
}

static Fury fury;

static {
fury = Fury.builder().build();
// register and generate serializer code.
fury.register(Record.class, true);
}

public static void main(String[] args) {
Record record = new Record(10, "abc", List.of("str1", "str2"), Map.of("k1", 10L, "k2", 20L));
System.out.println(record);
byte[] bytes = fury.serialize(record);
Object o = fury.deserialize(bytes);
System.out.println(o);
Preconditions.checkArgument(record.equals(o));
}
}

Then add io.fury.graalvm.Example build time init to native-image.properties configuration:

Args = --initialize-at-build-time=io.fury.graalvm.Example

What’s Changed

Full Changelog: https://github.com/alipay/fury/compare/v0.3.1...v0.4.0

--

--

Shawn.Yang

Software engineer in high-performance computing. Author of multi-language serialization framework https://github.com/apache/incubator-fury