📦apache / fory
← 返回首页
A blazingly fast multi-language serialization framework for idiomatic domain objects, schema IDL, and cross-language data exchange.
⚖️ Apache-2.0#cross-language#fast#jit#multiple-language#serialization🌐 fory.apache.org📅 创建于 2023-04-28🔄 更新于 2026-10-27

📄 仓库 README

在 GitHub 查看 ↗
来自 GitHub 仓库自述文件 · 版权归原作者所有
Apache Fory logo

Build Status Slack Channel X Maven Version Crates.io PyPI npm NuGet pub.dev

Apache Fory™ is a blazingly fast multi-language serialization framework for idiomatic domain objects, schema IDL, and cross-language data exchange.

https://fory.apache.org

Why Fory

Fory is built for fast, compact serialization across languages and implementations. It works with idiomatic objects in each language, supports shared schemas when you need a contract, and preserves object features such as shared and circular references.

  • Efficient Cross-Language Encoding: Exchange payloads across supported languages with compact binary encoding, metadata packing, schema evolution, shared/circular references, and polymorphic runtime types.
  • Domain Objects First: Serialize Java classes, Python dataclasses, Go structs, Rust/C++ structs, and generated or annotated model types directly. Preserve shared and circular references when object identity matters.
  • Reference-Aware Schema IDL: Support shared and circular references directly in the schema, alongside numbers, strings, lists, maps, arrays, enums, structs, and unions. Define schemas once, then generate native domain objects for each language without forcing wrapper types into user code.
  • Optimized Implementations: Java JIT serializers and generated/static serializers in other language implementations keep hot paths fast and payloads compact.
  • Language And Platform Support: Java, Python, C++, Go, Rust, JavaScript/TypeScript, C#, Swift, Dart, Scala, and Kotlin, including GraalVM native image, Android, Dart VM/Flutter/web, and Node.js/browser JavaScript.

For same-language workloads, Fory provides native serialization modes that support broader language-specific object models:

  • Java Native Serialization: A high-performance replacement for JDK serialization, Hessian, Kryo, and FST in Java-only systems. It supports JDK custom serialization semantics.
  • Python Native Serialization: A faster and more compact replacement for pickle and cloudpickle in Python-only systems. It supports classes, modules, functions, and custom object state, with fine-grained deserialization controls through DeserializationPolicy.

Fory also provides specialized formats for other data-processing requirements:

  • Row Format: Read fields, arrays, and nested values without rebuilding complete objects, with zero-copy access and partial reads.
  • Fory JSON: A Java JSON serialization framework built for maximum throughput through runtime-generated codecs and optimized readers and writers. Supports Java 8 and later on standard JDKs, GraalVM native images, and Android, including Java 17 records.

Performance

Benchmarks show Fory delivering higher throughput and smaller serialized payloads than common serialization frameworks on representative workloads. Java has the broadest comparison set; the other charts show language-specific results across supported languages.

Java Benchmarks

In Java serialization benchmarks, Fory reaches up to 170x the throughput of JDK serialization on selected workloads.

Java serialization throughput

Java deserialization throughput

Java xlang throughput

Python Benchmarks

Python serialization throughput

Rust Benchmarks

Rust serialization throughput

Benchmarks for C++, Go, JavaScript/TypeScript, C#, Swift, and Dart **C++** [Benchmarks](https://github.com/apache/fory/blob/HEAD/benchmarks/cpp)

C++ serialization throughput

**Go** [Benchmarks](https://github.com/apache/fory/blob/HEAD/benchmarks/go)

Go serialization throughput

**JavaScript/TypeScript** [Benchmarks](https://github.com/apache/fory/blob/HEAD/docs/benchmarks/object-serialization/xlang/javascript)

JavaScript serialization throughput

**C#** [Benchmarks](https://github.com/apache/fory/blob/HEAD/docs/benchmarks/object-serialization/xlang/csharp)

C# serialization throughput

**Swift** [Benchmarks](https://github.com/apache/fory/blob/HEAD/docs/benchmarks/object-serialization/xlang/swift)

Swift serialization throughput

**Dart** [Benchmarks](https://github.com/apache/fory/blob/HEAD/docs/benchmarks/object-serialization/xlang/dart)

Dart serialization throughput

Installation

Pick your language and run the package-manager command, or paste the dependency block into your build file.

Java

Maven:

<dependency>
  <groupId>org.apache.fory</groupId>
  <artifactId>fory-core</artifactId>
  <version>1.7.7</version>
</dependency>

Gradle:

implementation "org.apache.fory:fory-core:1.7.7"

On JDK25+, opening java.lang.invoke to Fory core is also recommended. It avoids the current-JDK Unsafe fallback and is required when Unsafe access is disabled or unavailable, including with --sun-misc-unsafe-memory-access=deny. Use ALL-UNNAMED when Fory is on the classpath:

--add-opens=java.base/java.lang.invoke=ALL-UNNAMED

Use the Fory core module name when Fory is on the module path:

--add-opens=java.base/java.lang.invoke=org.apache.fory.core

Scala

sbt:

libraryDependencies += "org.apache.fory" %% "fory-scala" % "1.7.7"

Kotlin

Gradle:

implementation("org.apache.fory:fory-kotlin:1.7.7")

Maven:

<dependency>
  <groupId>org.apache.fory</groupId>
  <artifactId>fory-kotlin</artifactId>
  <version>1.7.7</version>
</dependency>

Python

pip install pyfory

For row-format support:

pip install "pyfory[format]"

Rust

Cargo.toml:

[dependencies]
fory = "1.7.7"

C++

CMake:

include(FetchContent)
FetchContent_Declare(
  fory
  GIT_REPOSITORY https://github.com/apache/fory.git
  GIT_TAG v1.7.7
  SOURCE_SUBDIR cpp
)
FetchContent_MakeAvailable(fory)
target_link_libraries(my_app PRIVATE fory::serialization)

Bazel:

# MODULE.bazel
bazel_dep(name = "fory", version = "1.7.7")
git_override(module_name = "fory", remote = "https://github.com/apache/fory.git", commit = "v1.7.7")

# BUILD
deps = ["@fory//cpp/fory/serialization:fory_serialization"]

When building C++ with MSVC, enable the conforming preprocessor option /Zc:preprocessor; see the C++ installation guide for setup details.

See the C++ installation guide for complete CMake, Bazel, and source-build details.

Go

go get github.com/apache/fory/go/fory

JavaScript/TypeScript

npm install @apache-fory/core

For the Node.js string fast path:

npm install @apache-fory/core @apache-fory/hps

C#

dotnet add package Apache.Fory --version 1.7.7

Dart

```bash dart pub add fory:^1.

📈 近 7 天 Star 趋势

每日新增 Star(柱)与累计 Star(线)· 数据来自 GitHub

🏆 排名变化趋势

在各榜单中的排名历史(数字越小越靠前)

📋 历史上榜记录

每次快照的详细数据
日期 榜单 排名 周期新增 总 STAR