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
- feat(c#): c# serialization implementation by @chaokunyang in https://github.com/apache/fory/pull/3383
- feat(c#): add csharp target and idl integration tests by @chaokunyang in https://github.com/apache/fory/pull/3406
- feat(swift): implement fory serialization for swift language by @chaokunyang in https://github.com/apache/fory/pull/3359
- feat(swift): fory swift schema idl codegen by @chaokunyang in https://github.com/apache/fory/pull/3433
- feat(JavaScript): Support EXT,NAMED_EXT by @theweipeng in https://github.com/apache/fory/pull/3312
- feat(JavaScript): align xlang protocol by @theweipeng in https://github.com/apache/fory/pull/3316
- refactor(python): unify read/write api for python xlang and native mode by @chaokunyang in https://github.com/apache/fory/pull/3348
- feat(c++/python): support stream deserialization for c++ and python by @chaokunyang in https://github.com/apache/fory/pull/3307
- feat(python): fast cython struct serializer by @chaokunyang in https://github.com/apache/fory/pull/3443
- refactor(java): unify serializer write/read APIs and remove xwrite/xread by @chaokunyang in https://github.com/apache/fory/pull/3400
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
ThreadSafeForywrapper 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# guide: https://fory.apache.org/docs/guide/csharp/
- Compiler docs: https://fory.apache.org/docs/compiler/
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
@ForyObjectmacro 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, andAnyHashable - 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 guide: https://fory.apache.org/docs/guide/swift/
- Compiler docs: https://fory.apache.org/docs/compiler/
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
- feat(grpc): update lexer/parser to support service and rpc definitions for idl compilers by @ayush00git in https://github.com/apache/fory/pull/3308
- feat(JavaScript): Support EXT,NAMED_EXT by @theweipeng in https://github.com/apache/fory/pull/3312
- feat(go): add missing type resolver for uint64slice by @BrianLii in https://github.com/apache/fory/pull/3311
- feat(JavaScript): support ForyField by @theweipeng in https://github.com/apache/fory/pull/3314
- feat(JavaScript): align xlang protocol by @theweipeng in https://github.com/apache/fory/pull/3316
- feat(javascript): add float16 support by @ayush00git in https://github.com/apache/fory/pull/3253
- feat(JavaScript): Align testcases by @theweipeng in https://github.com/apache/fory/pull/3319
- feat(go): update float16 array/slice logic in createSerializer by @BrianLii in https://github.com/apache/fory/pull/3318
- feat(JavaScript): Align testcase by @theweipeng in https://github.com/apache/fory/pull/3320
- feat(JavaScript): Align testcases by @theweipeng in https://github.com/apache/fory/pull/3321
- feat(dart): align dart xlang serialization by @chaokunyang in https://github.com/apache/fory/pull/3322
- feat(go): improve test coverage for int slice primitive serializers by @BrianLii in https://github.com/apache/fory/pull/3313
- refactor(dart): revamp runtime API and unify codegen naming by @chaokunyang in https://github.com/apache/fory/pull/3323
- feat(JavaScript): Align xlang protocol by @theweipeng in https://github.com/apache/fory/pull/3326
- feat(JavaScript): fix test_polymorphic_map by @theweipeng in https://github.com/apache/fory/pull/3327
- feat(dart): align dart with xlang serialization spec by @chaokunyang in https://github.com/apache/fory/pull/3325
- feat(go): add support for bfloat16 by @BrianLii in https://github.com/apache/fory/pull/3310
- feat(javascript): add bfloat16 and bfloat16_array support by @miantalha45 in https://github.com/apache/fory/pull/3328
- feat(JavaScript): fix testcase by @theweipeng in https://github.com/apache/fory/pull/3334
- refactor(dart): register xlang types by Type by @chaokunyang in https://github.com/apache/fory/pull/3332
- feat(javascript): align buffer read/write API with Java naming by @miantalha45 in https://github.com/apache/fory/pull/3346
- refactor(python): unify read/write api for python xlang and native mode by @chaokunyang in https://github.com/apache/fory/pull/3348
- feat(dart): add float16 to dart by @ayush00git in https://github.com/apache/fory/pull/3336
- feat(swift): implement fory serialization for swift language by @chaokunyang in https://github.com/apache/fory/pull/3359
- feat(compiler): add gRPC flags to fory compiler by @ayush00git in https://github.com/apache/fory/pull/3361
- feat(swift): implement schema evolution compatible mode for fory swift by @chaokunyang in https://github.com/apache/fory/pull/3363
- feat(swift): dynamic any serializer for polymorphism by @chaokunyang in https://github.com/apache/fory/pull/3368
- feat(swift): support enum/time serialization for swift by @chaokunyang in https://github.com/apache/fory/pull/3371
- feat(c++): add msgpack cpp benchmark by @chaokunyang in https://github.com/apache/fory/pull/3365
- feat(swift): add direct Fory initializer and update Swift docs by @chaokunyang in https://github.com/apache/fory/pull/3373
- feat: Add IEEE 754 float16 (binary16) support to Rust runtime by @AshharAhmadKhan in https://github.com/apache/fory/pull/3252
- feat(c#): c# serialization implementation by @chaokunyang in https://github.com/apache/fory/pull/3383
- perf(csharp): add csharp benchmarks and optimize hot serialization paths by @chaokunyang in https://github.com/apache/fory/pull/3396
- refactor(benchmarks): rename benchmark directories and update links by @chaokunyang in https://github.com/apache/fory/pull/3398
- refactor(java): unify serializer write/read APIs and remove xwrite/xread by @chaokunyang in https://github.com/apache/fory/pull/3400
- perf(swift): add fory swift serialization benchmark and optimize perf by @chaokunyang in https://github.com/apache/fory/pull/3395
- refactor(c#): refactor serializer interface to minimize API surface by @chaokunyang in https://github.com/apache/fory/pull/3403
- feat(compiler): add csharp target and idl integration tests by @chaokunyang in https://github.com/apache/fory/pull/3406
- feat(swift): harden decode paths and add missing wire type support by @chaokunyang in https://github.com/apache/fory/pull/3427
- feat(c#): add max depth and code lint support by @chaokunyang in https://github.com/apache/fory/pull/3428
- feat(c++/python): support stream deserialization for c++ and python by @chaokunyang in https://github.com/apache/fory/pull/3307
- feat(swift): fory swift schema idl codegen by @chaokunyang in https://github.com/apache/fory/pull/3433
- feat(dart): add configurable deserialization size guardrails by @yash-agarwa-l in https://github.com/apache/fory/pull/3434
- refactor(dart): merge all runtime exceptions into single fory_exception.dart by @yash-agarwa-l in https://github.com/apache/fory/pull/3436
- perf(python): optimize pyfory collection serialization performance by @chaokunyang in https://github.com/apache/fory/pull/3441
- feat(python): fast cython struct serializer by @chaokunyang in https://github.com/apache/fory/pull/3443
- perf(python): add python benchmark suite by @chaokunyang in https://github.com/apache/fory/pull/3448
- feat(python/cpp): add streaming serialization support to python and c++ by @chaokunyang in https://github.com/apache/fory/pull/3449
- feat(python/c++): shrink stream buffers after struct deserialization by @chaokunyang in https://github.com/apache/fory/pull/3453
- perf(c#): add csharp benchmark results by @chaokunyang in https://github.com/apache/fory/pull/3451
- refactor: clean java serialize api by @chaokunyang in https://github.com/apache/fory/pull/3454
- feat(rust): forbid late type registration after resolver snapshot ini… by @Geethapranay1 in https://github.com/apache/fory/pull/3435
- perf(ci): add Cargo caching to Rust CI jobs by @moon3482 in https://github.com/apache/fory/pull/3431
- feat(python): add configurable size guardrails by @eyad-hazem-elmorsy in https://github.com/apache/fory/pull/3429
- feat(go): add go desrialization support via io streams by @ayush00git in https://github.com/apache/fory/pull/3374
- perf(go): remove //go:inline directives and mark cold paths as //go:noinline by @ayush00git in https://github.com/apache/fory/pull/3456
- feat(c++): add configurable deserialization size guardrails by @shivendra-dev54 in https://github.com/apache/fory/pull/3455
- perf(swift): optimize swift performance by @chaokunyang in https://github.com/apache/fory/pull/3457
- feat(swift): make fory swift usable as deps by @chaokunyang in https://github.com/apache/fory/pull/3462
- perf: add fory performance optimization skill by @chaokunyang in https://github.com/apache/fory/pull/3463
- feat(xlang): support per-type evolution override by @chaokunyang in https://github.com/apache/fory/pull/3465
- feat(javascript): limit the depth of deserialize & serialize by @miantalha45 in https://github.com/apache/fory/pull/3382
Bug Fix
- fix(java): Fix EnumSetSerializer for enums with overriding methods by @NotLebedev in https://github.com/apache/fory/pull/3315
- fix(java): Deserialize nested HashMap subclasses by @mandrean in https://github.com/apache/fory/pull/3342
- fix(java): support TreeSet/TreeMap subclasses without Comparator constructor in SortedSet/SortedMapSerializer by @mandrean in https://github.com/apache/fory/pull/3344
- fix(c++): fix buffer read/write bound check by @chaokunyang in https://github.com/apache/fory/pull/3418
- fix: avoid NoClassDefFoundError in supportCodegenForJavaSerialization by @siy in https://github.com/apache/fory/pull/3424
- fix(docs): updated the compiler guide by @ayush00git in https://github.com/apache/fory/pull/3420
- fix(python): return UTC-aware datetime instead of naive datetime by @yuta4895 in https://github.com/apache/fory/pull/3439
- fix(docs): adjusted sidebar position and fixed typos by @ayush00git in https://github.com/apache/fory/pull/3450
- fix(python): support tuple dataclass fields and object instances by @chaokunyang in https://github.com/apache/fory/pull/3468
- fix(python): fix python wheel build by @chaokunyang in https://github.com/apache/fory/pull/3469
- fix(java): avoid deflater meta decompression hang on invalid input by @chaokunyang in https://github.com/apache/fory/pull/3472
Other Improvements
- docs: update guide and compiler docs by @chaokunyang in https://github.com/apache/fory/pull/3298
- docs: fix broken docs links and add fory-site check ci by @chaokunyang in https://github.com/apache/fory/pull/3299
- docs(java): fix benchmark images by @chaokunyang in https://github.com/apache/fory/pull/3304
- docs(c++): update readme and benchmarks docs by @chaokunyang in https://github.com/apache/fory/pull/3305
- docs: fix incorrect docs by @chaokunyang in https://github.com/apache/fory/pull/3309
- chore: Bump release version to 0.15.0 by @chaokunyang in https://github.com/apache/fory/pull/3317
- chore(deps): bump org.apache.avro:avro from 1.11.4 to 1.11.5 in /benchmarks/java_benchmark by @dependabot[bot] in https://github.com/apache/fory/pull/3338
- chore(python): define dependencies for development environment by @yuta4895 in https://github.com/apache/fory/pull/3360
- docs(java): update java benchmark plots by @chaokunyang in https://github.com/apache/fory/pull/3366
- docs(swift): refine swift api and docs by @chaokunyang in https://github.com/apache/fory/pull/3372
- chore: Bump MessagePack from 2.5.172 to 2.5.187 by @dependabot[bot] in https://github.com/apache/fory/pull/3401
- docs(csharp): add csharp guide and update README by @chaokunyang in https://github.com/apache/fory/pull/3404
- docs: adjust guide docs sidebar by @chaokunyang in https://github.com/apache/fory/pull/3407
- chore(python): handle duplicate field names by @eyad-hazem-elmorsy in https://github.com/apache/fory/pull/3384
- docs: Fix grammar: we follows to we follow by @04cb in https://github.com/apache/fory/pull/3442
- chore(c#): prepare for c# release by @chaokunyang in https://github.com/apache/fory/pull/3464
- docs: add ai contributing policy by @chaokunyang in https://github.com/apache/fory/pull/3437
- docs: simplify PR AI checklist and rename AI policy file by @chaokunyang in https://github.com/apache/fory/pull/3470
New Contributors
- @BrianLii made their first contribution in https://github.com/apache/fory/pull/3311
- @NotLebedev made their first contribution in https://github.com/apache/fory/pull/3315
- @miantalha45 made their first contribution in https://github.com/apache/fory/pull/3328
- @yuta4895 made their first contribution in https://github.com/apache/fory/pull/3360
- @AshharAhmadKhan made their first contribution in https://github.com/apache/fory/pull/3252
- @siy made their first contribution in https://github.com/apache/fory/pull/3424
- @yash-agarwa-l made their first contribution in https://github.com/apache/fory/pull/3434
- @eyad-hazem-elmorsy made their first contribution in https://github.com/apache/fory/pull/3384
- @04cb made their first contribution in https://github.com/apache/fory/pull/3442
- @Geethapranay1 made their first contribution in https://github.com/apache/fory/pull/3435
- @moon3482 made their first contribution in https://github.com/apache/fory/pull/3431
- @shivendra-dev54 made their first contribution in https://github.com/apache/fory/pull/3455 Full Changelog: https://github.com/apache/fory/compare/v0.15.0...v0.16.0
