The Apache Fory team is pleased to announce the 0.15.0 release. This is a major release that includes 144 PR from 17 distinct contributors. See the Install Page to learn how to get the libraries for your platform.
Highlights
- feat(go): new golang xlang serialization implementation by @chaokunyang in https://github.com/apache/fory/pull/3063
- feat(rust): add tuple struct support and improve generic type handling by @ariesdevil in https://github.com/apache/fory/pull/3087
- refactor(rust): unify tuple struct and named struct protocol, and make schema evolution happy by @ariesdevil in https://github.com/apache/fory/pull/3092 feat(java/python/rust/go/cpp): align nullable meta for xlang struct fields serialization by @chaokunyang in https://github.com/apache/fory/pull/3093
- feat(java/python/rust/go/cpp): xlang fields reference and typeinfo alignment by @chaokunyang in https://github.com/apache/fory/pull/3107
- feat(cpp): add
SharedWeak<T>for circular reference support by @chaokunyang in https://github.com/apache/fory/pull/3109 - feat(xlang): support unsigned int for xlang by @chaokunyang in https://github.com/apache/fory/pull/3111 and https://github.com/apache/fory/pull/3113
- feat(xlang/java): refactor java native serialization type system and streaming type info for xlang by @chaokunyang in https://github.com/apache/fory/pull/3153
- feat(xlang): fory schema idl and compiler by @chaokunyang in https://github.com/apache/fory/pull/3106
- feat(compiler): add flatbuffers idl support by @chaokunyang in https://github.com/apache/fory/pull/3184
Go Serialization: First Release
Apache Fory 0.15.0 is the first release with official Go serialization support. The Go implementation delivers high-performance serialization with cross-language compatibility and production-focused configuration options.
Key capabilities:
- Cross-language mode with Java, Python,
cpp, Rust, and JavaScript (fory.WithXlang(true)) - Reflection-based serialization by default, plus optional experimental AOT code generation for hot paths
- Reference tracking for shared/circular object graphs (
fory.WithTrackRef(true)+fory:"ref"tags) - Compatible mode for schema evolution (
fory.WithCompatible(true)) supporting add/remove/reorder field changes - Thread-safe wrapper (
github.com/apache/fory/go/fory/threadsafe) for concurrent workloads
Quick Start
package main
import (
"github.com/apache/fory/go/fory"
)
type User struct {
ID int64
Name string
}
func main() {
f := fory.New(
fory.WithXlang(true),
fory.WithCompatible(true),
)
_ = f.RegisterStruct(User{}, 1)
data, _ := f.Serialize(&User{ID: 1, Name: "Alice"})
var out User
_ = f.Deserialize(data, &out)
}
- Go guide: https://fory.apache.org/docs/guide/go/
Go 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 | 66.0 | 97.8 | 184.9 |
| Struct | Deserialize | 82.7 | 90.9 | 309.6 |
| Structlist | Serialize | 632.8 | 1783.0 | 3340.0 |
| Structlist | Deserialize | 906.4 | 1891.0 | 5709.0 |
| Sample | Serialize | 137.3 | 367.3 | 1492.0 |
| Sample | Deserialize | 263.6 | 422.2 | 2661.0 |
| Samplelist | Serialize | 1962.0 | 7087.0 | 26169.0 |
| Samplelist | Deserialize | 4234.0 | 9321.0 | 53615.0 |
| Mediacontent | Serialize | 268.8 | 471.1 | 773.7 |
| Mediacontent | Deserialize | 426.9 | 553.1 | 1432.0 |
| Mediacontentlist | Serialize | 3736.0 | 9107.0 | 13911.0 |
| Mediacontentlist | Deserialize | 7247.0 | 11435.0 | 27975.0 |
Serialized data sizes (bytes):
| Data Type | Fory | Protobuf | Msgpack |
|---|---|---|---|
| Struct | 58 | 61 | 57 |
| Sample | 446 | 375 | 524 |
| MediaContent | 342 | 301 | 400 |
| StructList | 560 | 1260 | 1146 |
| SampleList | 7600 | 7560 | 10486 |
| MediaContentList | 5776 | 6080 | 8006 |
Note: Results depend on hardware and implementation versions. See the Go benchmark docs for details: https://fory.apache.org/docs/benchmarks/go/
Fory Schema IDL and Compiler: First Release
Apache Fory 0.15.0 also introduces the first release of the Fory schema IDL and compiler toolchain. You can define schemas once and generate native types and registration code across languages.
Key capabilities:
- Schema-first development with
enum,message, andunion - Fory-native field semantics:
optional(nullability),ref(shared/circular references),list, andmap - Multi-language code generation for Java, Python, Go, Rust, and
cpp - Protobuf (
.proto) and FlatBuffers (.fbs) frontend support, translated into Fory IR/codegen - Idiomatic generated APIs with
to/from byteshelpers
Quick Start
pip install fory-compiler
foryc example.fdl --lang java,python,go,rust,cpp --output ./generated
package example;
message Person [id=101] {
string name = 1;
optional string email = 2;
}
Generated Code Example
foryc generates idiomatic native types plus registration/byte helpers. For the
schema above, generated code looks like:
// Go (excerpt)
type Person struct {
Name string `fory:"id=1"`
Email optional.Optional[string] `fory:"id=2"`
}
func (m *Person) ToBytes() ([]byte, error) { ... }
func (m *Person) FromBytes(data []byte) error { ... }
func RegisterTypes(f *fory.Fory) error {
return f.RegisterStruct(Person{}, 101)
}
// Java (excerpt)
public class Person {
@ForyField(id = 1)
private String name;
@ForyField(id = 2, nullable = true)
private String email;
public byte[] toBytes() { ... }
public static Person fromBytes(byte[] bytes) { ... }
}
# Python (excerpt)
@pyfory.dataclass
class Person:
name: str = pyfory.field(id=1, default="")
email: Optional[str] = pyfory.field(id=2, default=None)
def to_bytes(self) -> bytes: ...
@classmethod
def from_bytes(cls, data: bytes) -> "Person": ...
- Compiler docs: https://fory.apache.org/docs/compiler/
Features
- feat(java): add config params for IdentityObjectIntMap by @jim-parsons in https://github.com/apache/fory/pull/3048
- perf: add cpp benchmark report by @chaokunyang in https://github.com/apache/fory/pull/3051
- feat(python): add Union type support for xlang serialization by @zhan7236 in https://github.com/apache/fory/pull/3059
- feat(go): new golang xlang serialization implementation by @chaokunyang in https://github.com/apache/fory/pull/3063
- feat(java): enhance ForyField annotation with tag ID support for optimized serialization by @mchernyakov in https://github.com/apache/fory/pull/3021
- feat(cpp): add iterator container serialization support by @zhan7236 in https://github.com/apache/fory/pull/3068
- refactor(go): refactor go error processing by @chaokunyang in https://github.com/apache/fory/pull/3069
- feat(rust): add generate_default attr, no longer generate
Defaulttrait impl by default by @ariesdevil in https://github.com/apache/fory/pull/3074 - feat(java): implement Union type support for cross-language serialization by @zhan7236 in https://github.com/apache/fory/pull/3062
- perf(go): add go benchmarks and optimize performance by @chaokunyang in https://github.com/apache/fory/pull/3071
- feat(python): add java python xlang tests and align protocol by @chaokunyang in https://github.com/apache/fory/pull/3077
- feat(rust): add i128 and isize type support by @ariesdevil in https://github.com/apache/fory/pull/3080
- feat(rust): add unit type and PhantomData serializer support by @ariesdevil in https://github.com/apache/fory/pull/3081
- refactor(python): refactor pyfory serializers code structure by @chaokunyang in https://github.com/apache/fory/pull/3083
- feat(rust): add union and none type support by @ariesdevil in https://github.com/apache/fory/pull/3084
- feat(go): add go struct field tag support by @chaokunyang in https://github.com/apache/fory/pull/3082
- feat(rust): add tuple struct support and improve generic type handling by @ariesdevil in https://github.com/apache/fory/pull/3087
- feat(rust): support configure rust field meta to reduce cost by @chaokunyang in https://github.com/apache/fory/pull/3089
- feat(cpp): support customize cpp field meta by @chaokunyang in https://github.com/apache/fory/pull/3088
- feat(ci): make rust xlang ci run separately to make ci faster by @chaokunyang in https://github.com/apache/fory/pull/3090
- feat(python): support configure field meta for python by @chaokunyang in https://github.com/apache/fory/pull/3091
- refactor(rust): unify tuple struct and named struct protocol, and make schema evolution happy by @ariesdevil in https://github.com/apache/fory/pull/3092
- feat(java): build Descriptors with final ref_tracking flags by @chaokunyang in https://github.com/apache/fory/pull/3070
- feat(java/python/rust/go/cpp): align nullable meta for xlang struct fields serialization by @chaokunyang in https://github.com/apache/fory/pull/3093
- feat(rust): implement fine-grained ref tracking for rust by @chaokunyang in https://github.com/apache/fory/pull/3101
- feat(cpp): fine-grained ref tracking for cpp by @chaokunyang in https://github.com/apache/fory/pull/3103
- feat(java/python/rust/go/cpp): xlang nullable/ref alignment by @chaokunyang in https://github.com/apache/fory/pull/3104
- feat(java/python/rust/go/cpp): xlang fields reference and typeinfo alignment by @chaokunyang in https://github.com/apache/fory/pull/3107
- feat(java/python/go/rust): add circular reference xlang tests by @chaokunyang in https://github.com/apache/fory/pull/3108
- feat(cpp): add
SharedWeak<T>for circular reference support by @chaokunyang in https://github.com/apache/fory/pull/3109 - feat(js): add schema-based per-field nullable support for xlang by @theharsh999 in https://github.com/apache/fory/pull/3100
- feat(xlang): support unsigned int for xlang by @chaokunyang in https://github.com/apache/fory/pull/3111
- feat(java): long array serializer support varint encoding by @Pigsy-Monk in https://github.com/apache/fory/pull/3115
- feat(xlang): support serialization for unsigned types and field encoding config by @chaokunyang in https://github.com/apache/fory/pull/3113
- perf(go): optimize go struct fields serialization perf by @chaokunyang in https://github.com/apache/fory/pull/3120
- feat(java): int array serializer support varint encoding by @Pigsy-Monk in https://github.com/apache/fory/pull/3124
- feat(java): support xlang serialization for GraalVM native image by @chaokunyang in https://github.com/apache/fory/pull/3126
- refactor(go): rename go interface to any by @chaokunyang in https://github.com/apache/fory/pull/3128
- refactor(xlang): remove magic number from protocol by @chaokunyang in https://github.com/apache/fory/pull/3137
- feat(xlang): use little endian when serializing array of multiple byte element size by @chaokunyang in https://github.com/apache/fory/pull/3140
- refactor(java/cpp): rename morphic to dynamic by @chaokunyang in https://github.com/apache/fory/pull/3142
- feat(xlang): add unsigned integer type support for JavaScript by @ayush00git in https://github.com/apache/fory/pull/3139
- feat: add unsigned number for dart by @ayush00git in https://github.com/apache/fory/pull/3144
- feat(xlang/java): refactor java native serialization type system and streaming type info for xlang by @chaokunyang in https://github.com/apache/fory/pull/3153
- feat(dart): add struct serializer support for unsigned integer types by @ayush00git in https://github.com/apache/fory/pull/3155
- feat(xlang): fory schema idl and compiler by @chaokunyang in https://github.com/apache/fory/pull/3106
- refactor(java): use
Types.NONE + 1as base java native id by @chaokunyang in https://github.com/apache/fory/pull/3180 - refactor(compiler): refactor fory compiler into hierarchical architecture by @chaokunyang in https://github.com/apache/fory/pull/3179
- feat(JavaScript): Add cross language test for JavaScript by @theweipeng in https://github.com/apache/fory/pull/3161
- feat(dart): add dart ci by @chaokunyang in https://github.com/apache/fory/pull/3189
- feat(compiler): add flatbuffers idl support by @chaokunyang in https://github.com/apache/fory/pull/3184
- feat(java): enhance java unsigned int/array type system by @chaokunyang in https://github.com/apache/fory/pull/3190
- feat(dart): add uint annotation types to the fory's codegen system by @ayush00git in https://github.com/apache/fory/pull/3181
- feat(dart): add uint struct support to the codegen system by @ayush00git in https://github.com/apache/fory/pull/3192
- feat(compiler): add union support to fory compiler and runtime by @chaokunyang in https://github.com/apache/fory/pull/3195
- feat(cpp): support private fields of cpp class by @chaokunyang in https://github.com/apache/fory/pull/3193
- feat(compiler): generate getter/setter/has/clear methods for cpp by @chaokunyang in https://github.com/apache/fory/pull/3199
- feat(JavaScript): impl the xlang string by @theweipeng in https://github.com/apache/fory/pull/3197
- feat(cpp): make fory enum/nuion macro in user namespace by @chaokunyang in https://github.com/apache/fory/pull/3200
- feat(go): use option for optional fields by @chaokunyang in https://github.com/apache/fory/pull/3202
- feat(cpp): make shared_ptr track ref by default by @chaokunyang in https://github.com/apache/fory/pull/3214
- feat(go): support [N]uint types array serializers by @ayush00git in https://github.com/apache/fory/pull/3201
- feat(xlang): reserve 4 bits for type meta by @chaokunyang in https://github.com/apache/fory/pull/3204
- feat(go): remove murmur hash go deps by @chaokunyang in https://github.com/apache/fory/pull/3217
- feat(compiler): refine generated cpp API by @chaokunyang in https://github.com/apache/fory/pull/3221
- feat(python): refactor cython buffer to use cpp buffer by @chaokunyang in https://github.com/apache/fory/pull/3219
- ci: speed up setup-python on windows by @chaokunyang in https://github.com/apache/fory/pull/3222
- feat(python): add buffer index accessors by @chaokunyang in https://github.com/apache/fory/pull/3223
- feat(xlang/compiler): support shared/circular reference serialization for fory/protobuf/flatbuffer idl by @chaokunyang in https://github.com/apache/fory/pull/3226
- feat(cpp): add polymorphic serialization support for
anyto compiler by @chaokunyang in https://github.com/apache/fory/pull/3232 - feat(JavaScript): impl xlang writer by @theweipeng in https://github.com/apache/fory/pull/3234
- feat(xlang): support control ref tracking for nested list map elements by @chaokunyang in https://github.com/apache/fory/pull/3236
- feat(compiler): add generated
to_bytes/from_bytesmethods to generated message/union by @chaokunyang in https://github.com/apache/fory/pull/3238 - refactor(cpp): use snake_case namestyle for cpp by @chaokunyang in https://github.com/apache/fory/pull/3240
- perf(go): optimize go perf by @chaokunyang in https://github.com/apache/fory/pull/3241
- refactor(go): adjust go buffer uint32/64 write/read name style by @chaokunyang in https://github.com/apache/fory/pull/3242
- refactor(compiler): refactor fory compiler command line by @chaokunyang in https://github.com/apache/fory/pull/3243
- feat(compiler): add compatible mode for idl by @chaokunyang in https://github.com/apache/fory/pull/3245
- feat(go): add float16 support to go by @ayush00git in https://github.com/apache/fory/pull/3235
- feat(java): generate java List for primitive array by @chaokunyang in https://github.com/apache/fory/pull/3247
- feat(JavaScript): Impl xlang Map and Collection by @theweipeng in https://github.com/apache/fory/pull/3249
- feat(compiler/runtime): use hash for generated class as id and refactor user type id encoding by @chaokunyang in https://github.com/apache/fory/pull/3248
- refactor(spec): remove language byte from xlang in protocol by @chaokunyang in https://github.com/apache/fory/pull/3256
- refactor(go): move go struct serializer init to struct_init.go by @chaokunyang in https://github.com/apache/fory/pull/3255
- feat(protocol): add float8 and bfloat16 to protocol spec by @chaokunyang in https://github.com/apache/fory/pull/3259
- feat(compiler): add evolution option support by @chaokunyang in https://github.com/apache/fory/pull/3262
- feat(compiler): update toString/repr/std::fmt::Debug for generated ref code by @chaokunyang in https://github.com/apache/fory/pull/3264
- perf: optimize schema evolution mode performance by @chaokunyang in https://github.com/apache/fory/pull/3260
- feat(JavaScript): Impl xlang JavaScript testcase by @theweipeng in https://github.com/apache/fory/pull/3263
- feat(compiler): add list keyword for list fields by @chaokunyang in https://github.com/apache/fory/pull/3295
Bug Fix
- fix(docs): fix graalvm link by @chaokunyang in https://github.com/apache/fory/pull/3056
- fix(Rust): prevent obtaining generic type metadata on custom types(struct/enum) by @urlyy in https://github.com/apache/fory/pull/3057
- fix(Rust): Move the calculating of TypeMeta::bytes and TypeMeta::hash ahead of serialization by @urlyy in https://github.com/apache/fory/pull/3060
- fix(java): Better ergonomics for AllowListChecker by @Asuka-star in https://github.com/apache/fory/pull/3061
- fix(rust): output original registered ID in type mismatch error log by @userzhy in https://github.com/apache/fory/pull/3067
- fix(java): Fix CopyOnWriteArrayList field serialization by @vybhavjs in https://github.com/apache/fory/pull/3079
- fix(go): reference tracking fails when >127 objects serialized by @jonyoder in https://github.com/apache/fory/pull/3086
- fix(java): fix abstract enum and abstract array serialization for GraalVM by @chaokunyang in https://github.com/apache/fory/pull/3095
- fix(rust): enable Union type cross-language serialization between Rust and Java by @ariesdevil in https://github.com/apache/fory/pull/3094
- fix: x86 architecture missing from universal2 macOS wheel by @madhavajay in https://github.com/apache/fory/pull/3114
- fix(java): optimize type resolver calls for xlang mode on graalvm by @chaokunyang in https://github.com/apache/fory/pull/3129
- fix(java): stop compilation service when shutdowning compile service by @chaokunyang in https://github.com/apache/fory/pull/3138
- fix(python): fix collection null elements read/write by @chaokunyang in https://github.com/apache/fory/pull/3149
- fix: typo in the xlang_serialization_spec.md by @ayush00git in https://github.com/apache/fory/pull/3151
- fix(java): use littlen endian for utf16 string on big endian by @chaokunyang in https://github.com/apache/fory/pull/3159
- fix(java): fix openj9 sliced string serde by @chaokunyang in https://github.com/apache/fory/pull/3160
- fix(cpp): fix fory cpp compile warnings by @chaokunyang in https://github.com/apache/fory/pull/3188
- fix(cpp): issue 3229 - compile error on gcc16 by @xflcx1991 in https://github.com/apache/fory/pull/3230
- fix(java): fix java ci maven module error by @chaokunyang in https://github.com/apache/fory/pull/3265
- fix(go): prevent panic in readUTF16LE with odd byte counts by @jonyoder in https://github.com/apache/fory/pull/3293
Other Improvements
- chore: bump release version to 0.14.0 by @chaokunyang in https://github.com/apache/fory/pull/3052
- chore: fix benchmark plot by @chaokunyang in https://github.com/apache/fory/pull/3053
- docs: add cpp doc in main readme.md by @chaokunyang in https://github.com/apache/fory/pull/3055
- chore(deps): bump org.apache.logging.log4j:log4j-core from 2.20.0 to 2.25.3 in /java/fory-test-core by @dependabot[bot] in https://github.com/apache/fory/pull/3065
- chore(python): Update badge styles in README.md by @chaokunyang in https://github.com/apache/fory/pull/3072
- chore(rust): revert rust crates version by @ariesdevil in https://github.com/apache/fory/pull/3075
- docs(cpp): Add MSVC compatibility to the CMake sample in the CPP document. by @Eiskomet in https://github.com/apache/fory/pull/3078
- chore: bump release version to 0.14.1 by @chaokunyang in https://github.com/apache/fory/pull/3096
- docs(go): add go serialization doc by @chaokunyang in https://github.com/apache/fory/pull/3121
- docs(go): fix go serialization doc by @chaokunyang in https://github.com/apache/fory/pull/3125
- docs(go): fix broken go doc links by @chaokunyang in https://github.com/apache/fory/pull/3127
- docs(go): add go version requirements by @chaokunyang in https://github.com/apache/fory/pull/3134
- docs(go): add docs for go pkg dev by @chaokunyang in https://github.com/apache/fory/pull/3135
- docs: adjust doc links and sync config by @chaokunyang in https://github.com/apache/fory/pull/3136
- docs: remove redundant prefix doc id by @chaokunyang in https://github.com/apache/fory/pull/3141
- docs: add field configuration doc by @chaokunyang in https://github.com/apache/fory/pull/3143
- docs: fix field type broken links by @chaokunyang in https://github.com/apache/fory/pull/3146
- docs: fix field type meta pos by @chaokunyang in https://github.com/apache/fory/pull/3147
- docs: fix native field type meta doc by @chaokunyang in https://github.com/apache/fory/pull/3148
- chore(java): move java benchmark to bench dir by @chaokunyang in https://github.com/apache/fory/pull/3152
- docs: fix typo and grammar in readme by @Howard-aile in https://github.com/apache/fory/pull/3156
- docs: update agents.md by @chaokunyang in https://github.com/apache/fory/pull/3162
- docs(compiler): update fory compiler doc by @chaokunyang in https://github.com/apache/fory/pull/3183
- docs: fix protobuf docs by @chaokunyang in https://github.com/apache/fory/pull/3185
- docs: add missing protobuf-idl.md by @chaokunyang in https://github.com/apache/fory/pull/3186
- docs(cpp): add cpp polymorphism doc by @chaokunyang in https://github.com/apache/fory/pull/3187
- docs: Fix links in README by @chaokunyang in https://github.com/apache/fory/pull/3212
- chore(java): rename _getTypeResolver to getTypeResolver by @chaokunyang in https://github.com/apache/fory/pull/3227
- chore(cpp): remove unique token from FORY_FIELD_CONFIG by @chaokunyang in https://github.com/apache/fory/pull/3228
- docs(compiler): merge type system doc into schema-idl odc by @chaokunyang in https://github.com/apache/fory/pull/3258
- chore: fix bump version and add rust/comiler auto release by @chaokunyang in https://github.com/apache/fory/pull/3257
- docs: move language impl reference to a new doc by @chaokunyang in https://github.com/apache/fory/pull/3261
- docs(go): add go benchmarks result by @chaokunyang in https://github.com/apache/fory/pull/3296
- chore: speedup windows ci by @chaokunyang in https://github.com/apache/fory/pull/3297
New Contributors
- @jim-parsons made their first contribution in https://github.com/apache/fory/pull/3048
- @Asuka-star made their first contribution in https://github.com/apache/fory/pull/3061
- @userzhy made their first contribution in https://github.com/apache/fory/pull/3067
- @ariesdevil made their first contribution in https://github.com/apache/fory/pull/3074
- @Eiskomet made their first contribution in https://github.com/apache/fory/pull/3078
- @vybhavjs made their first contribution in https://github.com/apache/fory/pull/3079
- @jonyoder made their first contribution in https://github.com/apache/fory/pull/3086
- @theharsh999 made their first contribution in https://github.com/apache/fory/pull/3100
- @madhavajay made their first contribution in https://github.com/apache/fory/pull/3114
- @Pigsy-Monk made their first contribution in https://github.com/apache/fory/pull/3115
- @ayush00git made their first contribution in https://github.com/apache/fory/pull/3139
- @Howard-aile made their first contribution in https://github.com/apache/fory/pull/3156
- @xflcx1991 made their first contribution in https://github.com/apache/fory/pull/3230
Full Changelog: https://github.com/apache/fory/compare/v0.14.1...v0.15.0
