Skip to content

v0.16.0

Choose a tag to compare

@chaokunyang chaokunyang released this 17 Mar 04:14
· 87 commits to main since this release

The Apache Fory team is pleased to announce the 0.16.0 release. This is a major release that includes 91 PR from 17 distinct contributors. See the Install Page to learn how to get the libraries for your platform.

Highlights

C# Serialization: First Release

Apache Fory 0.16.0 is the first release with official C# serialization support.
The C# runtime targets modern .NET workloads and brings the same object graph,
cross-language, and schema-evolution model available in other Fory runtimes.

Key capabilities:

  • High-performance binary serialization for .NET 8+ with source-generator-based serializers for [ForyObject] types
  • Cross-language mode with Java, Python, C++, Go, Rust, and JavaScript
  • Optional reference tracking for shared and circular object graphs
  • Compatible mode for schema evolution
  • Dynamic object payloads, custom serializers, and namespace/name registration APIs
  • ThreadSafeFory wrapper for concurrent service workloads
  • C# target support in the Fory IDL/compiler workflow

Quick Start

using Apache.Fory;

[ForyObject]
public sealed class User
{
    public long Id { get; set; }
    public string Name { get; set; } = string.Empty;
    public string? Email { get; set; }
}

Fory fory = Fory.Builder()
    .Xlang(true)
    .Compatible(true)
    .Build();
fory.Register<User>(1);

byte[] payload = fory.Serialize(new User
{
    Id = 1,
    Name = "Alice",
    Email = "alice@example.com",
});
User decoded = fory.Deserialize<User>(payload);

C# Benchmarks

Below are timing results (ns/op; lower is better) comparing Fory with Protobuf
and Msgpack across representative data structures.

Data Type Operation Fory Protobuf Msgpack
Struct Serialize 39.2 121.5 66.0
Struct Deserialize 58.3 180.1 102.6
Sample Serialize 269.2 562.6 339.6
Sample Deserialize 175.6 1084.9 531.8
MediaContent Serialize 306.3 434.7 351.5
MediaContent Deserialize 379.4 718.8 676.9
StructList Serialize 136.1 468.5 266.9
StructList Deserialize 221.1 687.0 488.5
SampleList Serialize 1198.9 2811.9 1635.7
SampleList Deserialize 791.5 5174.5 2629.2
MediaContentList Serialize 1393.9 2199.4 1710.9
MediaContentList Deserialize 1719.5 3373.1 3401.2

Serialized data sizes (bytes):

Data Type Fory Protobuf Msgpack
Struct 58 61 55
Sample 446 460 562
MediaContent 365 307 479
StructList 184 315 284
SampleList 1980 2315 2819
MediaContentList 1535 1550 2404

Benchmark details: https://fory.apache.org/docs/benchmarks/csharp/

Swift Serialization: First Release

Apache Fory 0.16.0 is also the first release with official Swift serialization
support. The Swift implementation focuses on idiomatic API design, macro-based
model serialization, cross-language compatibility, and strong support for object
graph workloads.

Key capabilities:

  • High-performance serialization for Swift value and reference types
  • @ForyObject macro for zero-boilerplate model serialization
  • Cross-language protocol compatibility with Java, Python, C++, Go, Rust, and JavaScript
  • Compatible mode for schema evolution across versions
  • Dynamic value support for Any, AnyObject, any Serializer, and AnyHashable
  • Reference tracking for shared/circular graphs, including weak references on classes
  • Swift target support in the Fory IDL/compiler workflow

Quick Start

import Fory

@ForyObject
struct User: Equatable {
    var name: String = ""
    var age: Int32 = 0
}

let fory = Fory(xlang: true, trackRef: false, compatible: true)
fory.register(User.self, id: 1)

let input = User(name: "Alice", age: 30)
let data = try fory.serialize(input)
let output: User = try fory.deserialize(data)

Swift Benchmarks

Below are throughput results (ops/sec; higher is better) comparing Fory with
Protobuf and Msgpack across representative data structures.

Data Type Operation Fory Protobuf Msgpack Fastest
Struct Serialize 9,727,950 6,572,406 141,248 fory (1.48x)
Struct Deserialize 11,889,570 8,584,510 99,792 fory (1.39x)
Sample Serialize 3,496,305 1,281,983 17,188 fory (2.73x)
Sample Deserialize 1,045,018 765,706 12,767 fory (1.36x)
MediaContent Serialize 1,425,354 678,542 29,048 fory (2.10x)
MediaContent Deserialize 614,447 478,298 12,711 fory (1.28x)
StructList Serialize 3,307,962 1,028,210 24,781 fory (3.22x)
StructList Deserialize 2,788,200 708,596 8,160 fory (3.93x)
SampleList Serialize 715,734 205,380 3,361 fory (3.48x)
SampleList Deserialize 199,317 133,425 1,498 fory (1.49x)
MediaContentList Serialize 364,097 103,721 5,538 fory (3.51x)
MediaContentList Deserialize 103,421 86,331 1,529 fory (1.20x)

Serialized data sizes (bytes):

Data Type Fory Protobuf Msgpack
MediaContent 365 301 524
MediaContentList 1535 1520 2639
Sample 446 375 737
SampleList 1980 1890 3698
Struct 58 61 65
StructList 184 315 338

Benchmark details: https://fory.apache.org/docs/benchmarks/swift/

Features

Bug Fix

  • fix(java): Fix EnumSetSerializer for enums with overriding methods by @NotLebedev in #3315
  • fix(java): Deserialize nested HashMap subclasses by @mandrean in #3342
  • fix(java): support TreeSet/TreeMap subclasses without Comparator constructor in SortedSet/SortedMapSerializer by @mandrean in #3344
  • fix(c++): fix buffer read/write bound check by @chaokunyang in #3418
  • fix: avoid NoClassDefFoundError in supportCodegenForJavaSerialization by @siy in #3424
  • fix(docs): updated the compiler guide by @ayush00git in #3420
  • fix(python): return UTC-aware datetime instead of naive datetime by @yuta4895 in #3439
  • fix(docs): adjusted sidebar position and fixed typos by @ayush00git in #3450
  • fix(python): support tuple dataclass fields and object instances by @chaokunyang in #3468
  • fix(python): fix python wheel build by @chaokunyang in #3469
  • fix(java): avoid deflater meta decompression hang on invalid input by @chaokunyang in #3472

Other Improvements

New Contributors