You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by ch...@apache.org on 2026/08/04 01:25:12 UTC
(fory-site) branch main updated: Update docs (#481)
This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git
The following commit(s) were added to refs/heads/main by this push:
new de0f9d9360 Update docs (#481)
de0f9d9360 is described below
commit de0f9d93608333e2eb9f718e8ad08fa4cde84a40
Author: Shawn Yang <sh...@gmail.com>
AuthorDate: Tue Aug 4 09:25:09 2026 +0800
Update docs (#481)
---
docs/object-serialization/kotlin/configuration.md | 2 +-
docs/object-serialization/python/native.md | 2 +-
.../object-serialization/python/troubleshooting.md | 2 +-
.../python/type-registration.md | 4 +-
docs/object-serialization/scala/configuration.md | 2 +-
docs/row-format/standard.md | 2 +-
...-fory_rust_versatile_serialization_framework.md | 2 +-
.../2026-07-20-fory_1_4_0_released.md | 2 +-
.../2026-07-31-fory_1_5_0_released.md | 4 +-
.../docusaurus-plugin-content-docs/current.json | 6 +-
.../{compiler => benchmarks}/_category_.json | 2 +-
.../current/benchmarks/cpp/README.md | 78 -
.../current/benchmarks/cpp/throughput.png | Bin 103838 -> 0 bytes
.../current/benchmarks/csharp/README.md | 89 --
.../current/benchmarks/csharp/throughput.png | Bin 108852 -> 0 bytes
.../current/benchmarks/dart/throughput.png | Bin 106606 -> 0 bytes
.../current/benchmarks/go/benchmark_results.txt | 326 ----
.../current/benchmarks/go/serialized_sizes.txt | 27 -
.../current/benchmarks/go/throughput.png | Bin 106797 -> 0 bytes
.../current/benchmarks/index.md | 126 ++
.../java/data/jmh-jdk-11-deserialization.csv | 153 --
.../java/data/jmh-jdk-11-serialization.csv | 153 --
.../benchmarks/java/data/jmh-jdk-11-zerocopy.csv | 73 -
.../java/java_heap_deserialize_compatible.png | Bin 91290 -> 0 bytes
.../java/java_heap_deserialize_consistent.png | Bin 102335 -> 0 bytes
.../java/java_heap_serialize_compatible.png | Bin 100843 -> 0 bytes
.../java/java_heap_serialize_consistent.png | Bin 100648 -> 0 bytes
.../java/java_offheap_deserialize_compatible.png | Bin 96677 -> 0 bytes
.../java/java_offheap_deserialize_consistent.png | Bin 101898 -> 0 bytes
.../java/java_offheap_serialize_compatible.png | Bin 109379 -> 0 bytes
.../java/java_offheap_serialize_consistent.png | Bin 110476 -> 0 bytes
.../java/java_repo_deserialization_throughput.png | Bin 105680 -> 0 bytes
.../java/java_repo_serialization_throughput.png | Bin 113741 -> 0 bytes
.../benchmarks/java/java_zero_copy_deserialize.png | Bin 90075 -> 0 bytes
.../benchmarks/java/java_zero_copy_serialize.png | Bin 86235 -> 0 bytes
.../current/benchmarks/java/json/README.md | 38 -
.../benchmarks/java/json/string_throughput.png | Bin 51989 -> 0 bytes
.../benchmarks/java/json/utf8_bytes_throughput.png | Bin 53649 -> 0 bytes
.../current/benchmarks/java/throughput.png | Bin 107433 -> 0 bytes
.../current/benchmarks/javascript/throughput.png | Bin 108900 -> 0 bytes
.../current/benchmarks/json/_category_.json | 6 +
.../current/benchmarks/json/java/README.md | 38 +
.../current/benchmarks/methodology.md | 40 +
.../object-serialization}/_category_.json | 2 +-
.../object-serialization/native/_category_.json | 6 +
.../object-serialization/native/java-graalvm.md | 110 ++
.../native}/java/README.md | 110 +-
.../object-serialization/xlang/_category_.json | 6 +
.../object-serialization/xlang/cpp/README.md | 78 +
.../object-serialization/xlang/csharp/README.md | 89 ++
.../xlang}/dart/README.md | 38 +-
.../{ => object-serialization/xlang}/go/README.md | 52 +-
.../object-serialization/xlang/java/README.md | 44 +
.../xlang}/javascript/README.md | 48 +-
.../xlang}/python/README.md | 126 +-
.../xlang}/rust/README.md | 94 +-
.../xlang}/swift/README.md | 40 +-
.../current/benchmarks/python/throughput.png | Bin 109981 -> 0 bytes
.../current/benchmarks/rust/throughput.png | Bin 102562 -> 0 bytes
.../current/benchmarks/swift/throughput.png | Bin 107942 -> 0 bytes
.../current/community/community.md | 89 +-
.../current/community/how_to_join_community.md | 95 +-
.../current/community/how_to_release.md | 298 +++-
.../current/community/how_to_verify.md | 56 +-
.../current/compiler/_category_.json | 4 +-
.../current/compiler/build-integration.md | 230 +++
.../current/compiler/cli.md | 670 ++++++++
.../current/compiler/flatbuffers-idl.md | 146 +-
.../compiler/generated-code/_category_.json | 6 +
.../current/compiler/generated-code/cpp.md | 157 ++
.../current/compiler/generated-code/csharp.md | 103 ++
.../current/compiler/generated-code/dart.md | 190 +++
.../current/compiler/generated-code/go.md | 148 ++
.../current/compiler/generated-code/index.md | 175 +++
.../current/compiler/generated-code/java.md | 149 ++
.../current/compiler/generated-code/javascript.md | 93 ++
.../current/compiler/generated-code/kotlin.md | 147 ++
.../current/compiler/generated-code/python.md | 120 ++
.../current/compiler/generated-code/rust.md | 150 ++
.../current/compiler/generated-code/scala.md | 156 ++
.../current/compiler/generated-code/swift.md | 102 ++
.../current/compiler/getting-started.md | 46 +
.../current/compiler/index.md | 171 ++-
.../current/compiler/protobuf-idl.md | 266 ++--
.../current/compiler/schema-idl.md | 1187 ++++++++-------
.../current/development/_category_.json | 6 +
.../current/development/building.md | 134 ++
.../current/development/cpp-debugging.md | 46 +
.../current/development/index.md | 32 +
.../current/grpc/_category_.json | 6 +
.../current/grpc/architecture.md | 35 +
.../current/grpc/cpp.md | 262 ++++
.../current/grpc/csharp.md | 300 ++++
.../current/grpc/dart.md | 259 ++++
.../current/grpc/go.md | 218 +++
.../current/grpc/index.md | 69 +
.../current/grpc/interoperability.md | 39 +
.../current/grpc/java.md | 376 +++++
.../current/grpc/javascript.md | 298 ++++
.../current/grpc/kotlin.md | 247 +++
.../current/grpc/python.md | 290 ++++
.../current/grpc/rust.md | 307 ++++
.../current/grpc/scala.md | 342 +++++
.../current/grpc/troubleshooting.md | 34 +
.../current/index.md | 57 +
.../current/introduction/_category_.json | 7 +-
.../current/introduction/choose-a-format.md | 53 +
.../current/introduction/index.md | 122 ++
.../current/introduction/product-model.md | 45 +
.../current/introduction/support-matrix.md | 37 +
.../current/json/_category_.json | 6 +
.../current/json/android.md | 137 ++
.../current/json/annotations.md | 685 +++++++++
.../current/json/custom-codecs.md | 266 ++++
.../current/json/getting-started.md | 163 ++
.../current/json/graalvm.md | 137 ++
.../current/json/index.md | 62 +
.../current/json/object-mapping.md | 202 +++
.../current/json/security.md | 87 ++
.../current/json/troubleshooting.md | 41 +
.../current/object-serialization/_category_.json | 6 +
.../object-serialization/cpp/_category_.json | 6 +
.../object-serialization/cpp/configuration.md | 249 +++
.../current/object-serialization/cpp/core-api.md | 350 +++++
.../object-serialization/cpp/custom-serializers.md | 371 +++++
.../current/object-serialization/cpp/index.md | 271 ++++
.../current/object-serialization/cpp/native.md | 194 +++
.../object-serialization/cpp/polymorphism.md | 482 ++++++
.../object-serialization/cpp/schema-evolution.md | 414 +++++
.../object-serialization/cpp/schema-metadata.md | 204 +++
.../object-serialization/cpp/supported-types.md | 292 ++++
.../object-serialization/cpp/type-registration.md | 254 ++++
.../current/object-serialization/cpp/xlang.md | 291 ++++
.../object-serialization/csharp/_category_.json | 6 +
.../object-serialization/csharp/configuration.md | 202 +++
.../object-serialization/csharp/core-api.md | 155 ++
.../csharp/custom-serializers.md | 92 ++
.../object-serialization/csharp/external-types.md | 305 ++++
.../current/object-serialization/csharp/index.md | 107 ++
.../object-serialization/csharp/references.md | 77 +
.../csharp/schema-evolution.md | 100 ++
.../object-serialization/csharp/schema-metadata.md | 140 ++
.../object-serialization/csharp/supported-types.md | 110 ++
.../object-serialization/csharp/thread-safety.md | 72 +
.../object-serialization/csharp/troubleshooting.md | 130 ++
.../csharp/type-registration.md | 93 ++
.../current/object-serialization/csharp/xlang.md | 129 ++
.../object-serialization/dart/_category_.json | 6 +
.../object-serialization/dart/code-generation.md | 126 ++
.../object-serialization/dart/configuration.md | 165 ++
.../current/object-serialization/dart/core-api.md | 145 ++
.../dart/custom-serializers.md | 141 ++
.../object-serialization/dart/external-types.md | 277 ++++
.../current/object-serialization/dart/index.md | 154 ++
.../object-serialization/dart/inheritance.md | 162 ++
.../object-serialization/dart/schema-evolution.md | 108 ++
.../object-serialization/dart/schema-metadata.md | 150 ++
.../object-serialization/dart/supported-types.md | 143 ++
.../object-serialization/dart/troubleshooting.md | 208 +++
.../object-serialization/dart/type-registration.md | 115 ++
.../dart/web-platform-support.md | 202 +++
.../current/object-serialization/dart/xlang.md | 254 ++++
.../deserialization-security-model.md | 532 +++++++
.../object-serialization/go/_category_.json | 6 +
.../object-serialization/go/configuration.md | 420 ++++++
.../current/object-serialization/go/core-api.md | 406 +++++
.../object-serialization/go/custom-serializers.md | 285 ++++
.../current/object-serialization/go/index.md | 157 ++
.../current/object-serialization/go/native.md | 199 +++
.../current/object-serialization/go/references.md | 356 +++++
.../object-serialization/go/schema-evolution.md | 374 +++++
.../object-serialization/go/schema-metadata.md | 391 +++++
.../object-serialization/go/supported-types.md | 371 +++++
.../object-serialization/go/thread-safety.md | 347 +++++
.../object-serialization/go/troubleshooting.md | 443 ++++++
.../object-serialization/go/type-registration.md | 264 ++++
.../current/object-serialization/go/xlang.md | 438 ++++++
.../current/object-serialization/index.md | 51 +
.../object-serialization/java/_category_.json | 6 +
.../object-serialization/java/advanced-features.md | 159 ++
.../current/object-serialization/java/android.md | 186 +++
.../object-serialization/java/compression.md | 132 ++
.../object-serialization/java/configuration.md | 117 ++
.../current/object-serialization/java/core-api.md | 120 ++
.../java/custom-serializers.md | 222 +++
.../current/object-serialization/java/graalvm.md | 193 +++
.../current/object-serialization/java/index.md | 243 +++
.../object-serialization/java/jdk-serialization.md | 89 ++
.../current/object-serialization/java/native.md | 291 ++++
.../object-serialization/java/object-copy.md | 350 +++++
.../object-serialization/java/schema-evolution.md | 250 +++
.../object-serialization/java/schema-metadata.md | 700 +++++++++
.../java/static-generated-serializers.md | 144 ++
.../object-serialization/java/troubleshooting.md | 243 +++
.../object-serialization/java/type-registration.md | 106 ++
.../object-serialization/java/virtual-threads.md | 114 ++
.../current/object-serialization/java/xlang.md | 355 +++++
.../javascript/_category_.json | 6 +
.../javascript/configuration.md | 138 ++
.../object-serialization/javascript/core-api.md | 244 +++
.../object-serialization/javascript/index.md | 168 +++
.../object-serialization/javascript/references.md | 111 ++
.../javascript/schema-evolution.md | 102 ++
.../javascript/schema-metadata.md | 158 ++
.../javascript/supported-types.md | 177 +++
.../javascript/troubleshooting.md | 89 ++
.../javascript/type-registration.md | 162 ++
.../object-serialization/javascript/xlang.md | 200 +++
.../object-serialization/kotlin/_category_.json | 6 +
.../object-serialization/kotlin/configuration.md | 170 +++
.../object-serialization/kotlin/default-values.md | 132 ++
.../current/object-serialization/kotlin/index.md | 136 ++
.../current/object-serialization/kotlin/native.md | 194 +++
.../object-serialization/kotlin/schema-metadata.md | 120 ++
.../kotlin/static-generated-serializers.md | 281 ++++
.../current/object-serialization/kotlin/xlang.md | 58 +
.../current/object-serialization/native.md | 41 +
.../object-serialization/python/_category_.json | 6 +
.../object-serialization/python/configuration.md | 282 ++++
.../object-serialization/python/core-api.md | 110 ++
.../python/custom-serializers.md | 138 ++
.../python/functions-classes-methods.md | 140 ++
.../current/object-serialization/python/index.md | 167 ++
.../current/object-serialization/python/native.md | 173 +++
.../python/numpy-integration.md | 103 ++
.../object-serialization/python/out-of-band.md | 179 +++
.../python/schema-evolution.md | 123 ++
.../object-serialization/python/schema-metadata.md | 518 +++++++
.../python/serialization-hooks.md | 56 +
.../object-serialization/python/troubleshooting.md | 41 +-
.../python/type-registration.md | 38 +-
.../current/object-serialization/python/xlang.md | 307 ++++
.../current/object-serialization/runtimes.md | 37 +
.../object-serialization/rust/_category_.json | 6 +
.../object-serialization/rust/configuration.md | 197 +++
.../current/object-serialization/rust/core-api.md | 212 +++
.../rust/custom-serializers.md | 183 +++
.../object-serialization/rust/external-types.md | 394 +++++
.../current/object-serialization/rust/index.md | 165 ++
.../current/object-serialization/rust/native.md | 242 +++
.../object-serialization/rust/polymorphism.md | 217 +++
.../object-serialization/rust/references.md | 213 +++
.../object-serialization/rust/schema-evolution.md | 261 ++++
.../object-serialization/rust/schema-metadata.md | 491 ++++++
.../object-serialization/rust/troubleshooting.md | 210 +++
.../object-serialization/rust/type-registration.md | 133 ++
.../current/object-serialization/rust/xlang.md | 303 ++++
.../object-serialization/scala/_category_.json | 6 +
.../object-serialization/scala/configuration.md | 211 +++
.../object-serialization/scala/default-values.md | 168 +++
.../current/object-serialization/scala/index.md | 122 ++
.../current/object-serialization/scala/native.md | 181 +++
.../object-serialization/scala/schema-metadata.md | 119 ++
.../current/object-serialization/scala/xlang.md | 196 +++
.../current/object-serialization/security.md | 166 ++
.../object-serialization/swift/_category_.json | 6 +
.../object-serialization/swift/configuration.md | 163 ++
.../current/object-serialization/swift/core-api.md | 170 +++
.../swift/custom-serializers.md | 289 ++++
.../object-serialization/swift/external-types.md | 278 ++++
.../current/object-serialization/swift/index.md | 85 ++
.../object-serialization/swift/polymorphism.md | 203 +++
.../object-serialization/swift/references.md | 111 ++
.../object-serialization/swift/schema-evolution.md | 116 ++
.../object-serialization/swift/schema-metadata.md | 224 +++
.../object-serialization/swift/troubleshooting.md | 112 ++
.../swift/type-registration.md | 97 ++
.../current/object-serialization/swift/xlang.md | 181 +++
.../object-serialization/xlang/_category_.json | 6 +
.../current/object-serialization/xlang/index.md | 185 +++
.../object-serialization/xlang/nullability.md | 267 ++++
.../object-serialization/xlang/polymorphism.md | 28 +
.../object-serialization/xlang/references.md | 300 ++++
.../object-serialization/xlang/schema-evolution.md | 28 +
.../object-serialization/xlang/troubleshooting.md | 313 ++++
.../object-serialization/xlang/type-identity.md | 295 ++++
.../object-serialization/xlang/type-system.md | 41 +
.../object-serialization/xlang/zero-copy.md | 203 +++
.../current/row-format/_category_.json | 6 +
.../current/row-format/compact.md | 50 +
.../current/row-format/cpp.md | 509 +++++++
.../current/row-format/index.md | 42 +
.../current/row-format/java.md | 274 ++++
.../current/row-format/python.md | 196 +++
.../current/row-format/rust.md | 189 +++
.../current/row-format/standard.md | 51 +
.../current/row-format/troubleshooting.md | 34 +
.../specification/java_serialization_spec.md | 757 +++++++---
.../current/specification/row_format_spec.md | 538 ++++---
.../specification/xlang_implementation_guide.md | 1411 ++++++-----------
.../specification/xlang_serialization_spec.md | 1593 ++++++++++++++++----
.../current/specification/xlang_type_mapping.md | 292 ++--
.../current/start/_category_.json | 7 +-
.../current/start/cpp.md | 42 +
.../current/start/csharp.md | 39 +
.../current/start/dart.md | 40 +
.../current/start/go.md | 42 +
.../current/start/index.md | 59 +
.../current/start/java.md | 44 +
.../current/start/javascript.md | 41 +
.../current/start/kotlin.md | 42 +
.../current/start/python.md | 41 +
.../current/start/rust.md | 41 +
.../current/start/scala.md | 42 +
.../current/start/swift.md | 39 +
.../version-1.5.0/guide/csharp/external-types.md | 2 +-
.../download/index.md | 2 +-
307 files changed, 44503 insertions(+), 4069 deletions(-)
diff --git a/docs/object-serialization/kotlin/configuration.md b/docs/object-serialization/kotlin/configuration.md
index 175b2a4d4e..4d70d499fc 100644
--- a/docs/object-serialization/kotlin/configuration.md
+++ b/docs/object-serialization/kotlin/configuration.md
@@ -174,5 +174,5 @@ Security-related configuration:
- Keep `withMaxTypeFields(...)`, `withMaxTypeMetaBytes(...)`, and the remote schema-version limits
at their defaults unless the data is not malicious and a trusted peer sends larger metadata or
many schema versions.
-- Follow [Java Configuration](../java/configuration.md#security) for allow-listing and unknown-class
+- Follow [Object Serialization Security](../security.md) for allow-listing and unknown-class
controls.
diff --git a/docs/object-serialization/python/native.md b/docs/object-serialization/python/native.md
index fbab2d008e..d7d5225516 100644
--- a/docs/object-serialization/python/native.md
+++ b/docs/object-serialization/python/native.md
@@ -189,4 +189,4 @@ Keep the payload in native mode. Xlang mode does not execute Python `__reduce__`
- [Xlang Serialization](xlang.md) - Cross-language Python payloads
- [Configuration](configuration.md) - Python `Fory` options
- [Out-of-Band Serialization](out-of-band.md) - Zero-copy buffer support
-- [Configuration](configuration.md#security) - Deserialization policies
+- [Object Serialization Security](../security.md) - Deserialization policies
diff --git a/docs/object-serialization/python/troubleshooting.md b/docs/object-serialization/python/troubleshooting.md
index 11928d08c5..bda885242b 100644
--- a/docs/object-serialization/python/troubleshooting.md
+++ b/docs/object-serialization/python/troubleshooting.md
@@ -192,4 +192,4 @@ ruff check --fix .
- [Configuration](configuration.md) - Fory parameters
- [Type Registration](type-registration.md) - Registration best practices
-- [Configuration](configuration.md#security) - Security configuration
+- [Object Serialization Security](../security.md) - Security configuration
diff --git a/docs/object-serialization/python/type-registration.md b/docs/object-serialization/python/type-registration.md
index 917537c767..5c6a8f34da 100644
--- a/docs/object-serialization/python/type-registration.md
+++ b/docs/object-serialization/python/type-registration.md
@@ -19,7 +19,7 @@ license: |
limitations under the License.
---
-This page covers Python type registration APIs. Use [Configuration](configuration.md#security) for
+This page covers Python type registration APIs. Use [Object Serialization Security](../security.md) for
strict-mode policy, max-depth limits, and trusted-data guidance.
## Type Registration
@@ -88,5 +88,5 @@ application object.
## Related Topics
- [Configuration](configuration.md) - Fory parameters
-- [Configuration](configuration.md#security) - Strict mode, deserialization policies, and maximum read depth
+- [Object Serialization Security](../security.md) - Strict mode, deserialization policies, and maximum read depth
- [Custom Serializers](custom-serializers.md) - Custom serialization
diff --git a/docs/object-serialization/scala/configuration.md b/docs/object-serialization/scala/configuration.md
index 18aee91be5..ae81c3cf66 100644
--- a/docs/object-serialization/scala/configuration.md
+++ b/docs/object-serialization/scala/configuration.md
@@ -218,5 +218,5 @@ Security-related configuration:
- Keep `withMaxTypeFields(...)`, `withMaxTypeMetaBytes(...)`, and the remote schema-version limits
at their defaults unless the data is not malicious and a trusted peer sends larger metadata or
many schema versions.
-- Follow [Java Configuration](../java/configuration.md#security) for allow-listing and unknown-class
+- Follow [Object Serialization Security](../security.md) for allow-listing and unknown-class
controls.
diff --git a/docs/row-format/standard.md b/docs/row-format/standard.md
index f7d1b1aa62..b420f1e9f5 100644
--- a/docs/row-format/standard.md
+++ b/docs/row-format/standard.md
@@ -39,7 +39,7 @@ and element types. The normative byte layout, alignment rules, type table, and
endianness are defined by the
[Row Format Specification](../specification/row_format_spec.md).
-Row Format is intended for analytics, memory-mapped data, selective field
+Row Format is intended only for trusted analytics data, including memory-mapped data, selective field
access, and data pipelines. Use [Object Serialization](../object-serialization/index.md)
when the application needs general object graphs, shared or circular references,
or complete object reconstruction as its primary access pattern.
diff --git a/i18n/zh-CN/docusaurus-plugin-content-blog/2025-10-29-fory_rust_versatile_serialization_framework.md b/i18n/zh-CN/docusaurus-plugin-content-blog/2025-10-29-fory_rust_versatile_serialization_framework.md
index cc2ae5f4b8..6a2cab4f69 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-blog/2025-10-29-fory_rust_versatile_serialization_framework.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-blog/2025-10-29-fory_rust_versatile_serialization_framework.md
@@ -359,7 +359,7 @@ fory-derive/ # 过程宏

-这张图展示了 Fory 为何适合性能敏感型系统:代码生成的序列化器、紧凑二进制布局和专门优化的集合路径,可以在不牺牲复杂 Rust 应用所需能力的前提下提供高吞吐量。完整的环境信息、负载定义、载荷大小和详细结果,请参阅[完整 Rust 基准测试报告](/zh-CN/docs/next/benchmarks/object-serialization/xlang/rust/)。
+这张图展示了 Fory 为何适合性能敏感型系统:代码生成的序列化器、紧凑二进制布局和专门优化的集合路径,可以在不牺牲复杂 Rust 应用所需能力的前提下提供高吞吐量。完整的环境信息、负载定义、载荷大小和详细结果,请参阅[完整 Rust 基准测试报告](https://fory.apache.org/zh-CN/docs/benchmarks/object-serialization/xlang/rust/)。
## 何时使用 Apache Fory Rust
diff --git a/i18n/zh-CN/docusaurus-plugin-content-blog/2026-07-20-fory_1_4_0_released.md b/i18n/zh-CN/docusaurus-plugin-content-blog/2026-07-20-fory_1_4_0_released.md
index 2403541ea3..39a52a3f40 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-blog/2026-07-20-fory_1_4_0_released.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-blog/2026-07-20-fory_1_4_0_released.md
@@ -64,7 +64,7 @@ public final class JsonExample {
}
```
-完整的类型模型、注解与 mix-in、动态属性、自定义序列化器、安全控制,以及 Android 或 GraalVM 的配置方法,请参阅 [Fory JSON 文档](/zh-CN/docs/guide/java/json_support)。
+完整的类型模型、注解与 mix-in、动态属性、自定义序列化器、安全控制,以及 Android 或 GraalVM 的配置方法,请参阅 [Fory JSON 文档](/docs/guide/java/json_support)。
## 新功能
diff --git a/i18n/zh-CN/docusaurus-plugin-content-blog/2026-07-31-fory_1_5_0_released.md b/i18n/zh-CN/docusaurus-plugin-content-blog/2026-07-31-fory_1_5_0_released.md
index 708f4817ea..acf6ecd46e 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-blog/2026-07-31-fory_1_5_0_released.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-blog/2026-07-31-fory_1_5_0_released.md
@@ -106,7 +106,7 @@ fory.Register<ThirdParty.User>(100);
byte[] bytes = fory.Serialize(user);
```
-有关构造要求、嵌套容器、动态值和高级映射,请参阅 [Rust](/zh-CN/docs/guide/rust/external_types)、[Dart](/zh-CN/docs/guide/dart/external_types)、[Swift](/zh-CN/docs/guide/swift/external_types) 和 [C#](/zh-CN/docs/guide/csharp/external_types) 的专门指南。
+有关构造要求、嵌套容器、动态值和高级映射,请参阅 [Rust](/docs/guide/rust/external_types)、[Dart](/docs/guide/dart/external_types)、[Swift](/docs/guide/swift/external_types) 和 [C#](/docs/guide/csharp/external_types) 的专门指南。
## C# 和 Dart 的类继承支持
@@ -152,7 +152,7 @@ class TextMessage extends MessageBase {
生成的 `TextMessage` Schema 包含 `sequence` 和 `text`,但不包含继承的私有字段 `_cache`。该选项不会忽略继承的公共字段,也不会忽略由子类自身声明的私有字段。
-有关构造函数规则、跨 package 的私有字段访问、mix-in、泛型、引用和 Schema 兼容性,请参阅 [C# 类继承](/zh-CN/docs/guide/csharp/basic_serialization#类继承)和 [Dart 继承](/zh-CN/docs/guide/dart/inheritance)。
+有关构造函数规则、跨 package 的私有字段访问、mix-in、泛型、引用和 Schema 兼容性,请参阅 [C# 类继承](/docs/guide/csharp/basic_serialization#class-inheritance)和 [Dart 继承](/docs/guide/dart/inheritance)。
## 新功能
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current.json b/i18n/zh-CN/docusaurus-plugin-content-docs/current.json
index e70b0aad43..8217dfef32 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current.json
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current.json
@@ -4,7 +4,7 @@
"description": "The label for version current"
},
"sidebar.docsSidebar.category.Introduction": {
- "message": "介绍",
+ "message": "简介",
"description": "The label for category Introduction in sidebar docsSidebar"
},
"sidebar.docsSidebar.category.Getting Started": {
@@ -12,7 +12,7 @@
"description": "The label for category Getting Started in sidebar docsSidebar"
},
"sidebar.docsSidebar.category.Benchmarks": {
- "message": "性能测试",
+ "message": "基准测试",
"description": "The label for category Benchmarks in sidebar docsSidebar"
},
"sidebar.docsSidebar.category.Object Serialization": {
@@ -20,7 +20,7 @@
"description": "The label for category Object Serialization in sidebar docsSidebar"
},
"sidebar.docsSidebar.category.Row Format": {
- "message": "Row 格式",
+ "message": "行格式",
"description": "The label for category Row Format in sidebar docsSidebar"
},
"sidebar.docsSidebar.category.Fory JSON": {
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/_category_.json b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/_category_.json
similarity index 62%
copy from i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/_category_.json
copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/_category_.json
index abf19e9fcb..aed75caeba 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/_category_.json
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/_category_.json
@@ -1,6 +1,6 @@
{
"position": 3,
- "label": "Schema IDL 与编译器",
+ "label": "基准测试",
"collapsible": true,
"collapsed": true
}
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/cpp/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/cpp/README.md
deleted file mode 100644
index 53e1284bea..0000000000
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/cpp/README.md
+++ /dev/null
@@ -1,78 +0,0 @@
-# C++ 基准性能报告
-
-_生成于 2026-05-08 17:54:45_
-
-## 如何生成本报告
-
-```bash
-cd benchmarks/cpp/build
-./fory_benchmark --benchmark_format=json --benchmark_out=benchmark_results.json
-cd ..
-python benchmark_report.py --json-file build/benchmark_results.json --output-dir report
-```
-
-## 基准图表
-
-图表展示吞吐量(ops/sec);数值越高越好。
-
-
-
-## 硬件与操作系统信息
-
-| 键 | 值 |
-| -------------------------- | ------------------------- |
-| 操作系统 | Darwin 24.6.0 |
-| 机器架构 | arm64 |
-| 处理器 | arm |
-| CPU 核心数(物理) | 12 |
-| CPU 核心数(逻辑) | 12 |
-| 总内存(GB) | 48.0 |
-| 基准日期 | 2026-05-08T16:29:28+08:00 |
-| CPU 核心数(基准采集) | 12 |
-
-## 基准结果
-
-### 延迟结果(纳秒)
-
-| 数据类型 | 操作 | fory (ns) | protobuf (ns) | msgpack (ns) | 最快 |
-| ----------------- | ---- | --------- | ------------- | ------------ | ------- |
-| NumericStruct | 序列化 | 24.9 | 48.2 | 91.0 | fory |
-| NumericStruct | 反序列化 | 26.6 | 33.0 | 1194.5 | fory |
-| Sample | 序列化 | 62.3 | 97.3 | 314.6 | fory |
-| Sample | 反序列化 | 371.1 | 689.0 | 2649.9 | fory |
-| MediaContent | 序列化 | 115.0 | 857.2 | 311.7 | fory |
-| MediaContent | 反序列化 | 406.5 | 1193.1 | 3311.1 | fory |
-| NumericStructList | 序列化 | 81.7 | 495.0 | 485.6 | fory |
-| NumericStructList | 反序列化 | 180.9 | 410.6 | 5733.1 | fory |
-| SampleList | 序列化 | 284.9 | 5004.9 | 1579.6 | fory |
-| SampleList | 反序列化 | 1928.7 | 5118.1 | 13396.8 | fory |
-| MediaContentList | 序列化 | 464.8 | 4861.1 | 1671.1 | fory |
-| MediaContentList | 反序列化 | 2099.8 | 6610.3 | 13963.4 | fory |
-
-### 吞吐结果(ops/sec)
-
-| 数据类型 | 操作 | fory TPS | protobuf TPS | msgpack TPS | 最快 |
-| ----------------- | ---- | ---------- | ------------ | ---- | ------- |
-| NumericStruct | 序列化 | 40,087,668 | 20,733,305 | 10,989,907 | fory |
-| NumericStruct | 反序列化 | 37,606,127 | 30,296,744 | 837,189 | fory |
-| Sample | 序列化 | 16,041,299 | 10,277,207 | 3,178,983 | fory |
-| Sample | 反序列化 | 2,694,434 | 1,451,449 | 377,373 | fory |
-| MediaContent | 序列化 | 8,698,574 | 1,166,539 | 3,208,626 | fory |
-| MediaContent | 反序列化 | 2,460,094 | 838,185 | 302,013 | fory |
-| NumericStructList | 序列化 | 12,240,275 | 2,020,102 | 2,059,276 | fory |
-| NumericStructList | 反序列化 | 5,527,333 | 2,435,246 | 174,427 | fory |
-| SampleList | 序列化 | 3,510,210 | 199,804 | 633,061 | fory |
-| SampleList | 反序列化 | 518,490 | 195,386 | 74,645 | fory |
-| MediaContentList | 序列化 | 2,151,560 | 205,715 | 598,396 | fory |
-| MediaContentList | 反序列化 | 476,241 | 151,280 | 71,616 | fory |
-
-### 序列化数据大小(字节)
-
-| 数据类型 | fory | protobuf | msgpack |
-| ----------------- | ---- | -------- | ------- |
-| NumericStruct | 78 | 93 | 87 |
-| Sample | 445 | 375 | 530 |
-| MediaContent | 362 | 301 | 480 |
-| NumericStructList | 255 | 475 | 449 |
-| SampleList | 1978 | 1890 | 2664 |
-| MediaContentList | 1531 | 1520 | 2421 |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/cpp/throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/cpp/throughput.png
deleted file mode 100644
index 4ae6119fa7..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/cpp/throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/csharp/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/csharp/README.md
deleted file mode 100644
index f4c27a9e76..0000000000
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/csharp/README.md
+++ /dev/null
@@ -1,89 +0,0 @@
-# C# 基准性能报告
-
-_生成于 2026-05-08 17:54:45_
-
-## 如何生成本报告
-
-```bash
-cd benchmarks/csharp
-dotnet run -c Release --project ./Fory.CSharpBenchmark.csproj -- --output build/benchmark_results.json
-python3 benchmark_report.py --json-file build/benchmark_results.json --output-dir report
-```
-
-## 基准图表
-
-图表展示吞吐量(ops/sec);数值越高越好。
-
-
-
-## 硬件与操作系统信息
-
-| 键 | 值 |
-| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
-| 操作系统 | Darwin 24.6.0 Darwin Kernel Version 24.6.0: Wed Oct 15 21:12:15 PDT 2025; root:xnu-11417.140.69.703.14~1/RELEASE_ARM64_T6041 |
-| 操作系统 Architecture | Arm64 |
-| 机器架构 | Arm64 |
-| 运行时版本 | 8.0.24 |
-| 基准日期(UTC) | 2026-05-08T08:17:48.7871870Z |
-| 预热秒数 | 1 |
-| 持续秒数 | 3 |
-| CPU 逻辑核心数(基准采集) | 12 |
-| CPU 核心数(物理) | 12 |
-| CPU 核心数(逻辑) | 12 |
-| 总内存(GB) | 48.0 |
-
-## 基准覆盖范围
-
-| 键 | 值 |
-| ------------------- | ---------------------------------------------------------------------- |
-| 输入 JSON 中的用例 | 36 / 36 |
-| 序列化器 | fory, msgpack, protobuf |
-| 数据类型 | struct, sample, mediacontent, structlist, samplelist, mediacontentlist |
-| 操作 | serialize, deserialize |
-
-## 基准结果
-
-### 延迟结果(纳秒)
-
-| 数据类型 | 操作 | fory (ns) | protobuf (ns) | msgpack (ns) | 最快 |
-| ----------------- | ---- | --------- | ------------- | ------------ | ------- |
-| NumericStruct | 序列化 | 50.3 | 170.8 | 107.8 | fory |
-| NumericStruct | 反序列化 | 82.4 | 252.0 | 143.4 | fory |
-| Sample | 序列化 | 263.2 | 607.1 | 377.1 | fory |
-| Sample | 反序列化 | 199.4 | 1191.7 | 785.6 | fory |
-| MediaContent | 序列化 | 379.7 | 509.6 | 417.6 | fory |
-| MediaContent | 反序列化 | 450.3 | 846.6 | 791.4 | fory |
-| NumericStructList | 序列化 | 183.7 | 641.8 | 447.8 | fory |
-| NumericStructList | 反序列化 | 288.3 | 974.3 | 702.1 | fory |
-| SampleList | 序列化 | 1205.7 | 3559.1 | 1864.1 | fory |
-| SampleList | 反序列化 | 895.1 | 5710.3 | 2757.4 | fory |
-| MediaContentList | 序列化 | 1495.4 | 2473.6 | 1812.4 | fory |
-| MediaContentList | 反序列化 | 1946.7 | 3789.3 | 3778.4 | fory |
-
-### 吞吐结果(ops/sec)
-
-| 数据类型 | 操作 | fory TPS | protobuf TPS | msgpack TPS | 最快 |
-| ----------------- | ---- | ---------- | ------------ | ---- | ------- |
-| NumericStruct | 序列化 | 19,881,457 | 5,853,473 | 9,276,378 | fory |
-| NumericStruct | 反序列化 | 12,137,374 | 3,968,585 | 6,973,504 | fory |
-| Sample | 序列化 | 3,799,418 | 1,647,119 | 2,652,142 | fory |
-| Sample | 反序列化 | 5,016,006 | 839,129 | 1,272,975 | fory |
-| MediaContent | 序列化 | 2,633,704 | 1,962,428 | 2,394,549 | fory |
-| MediaContent | 反序列化 | 2,220,537 | 1,181,222 | 1,263,568 | fory |
-| NumericStructList | 序列化 | 5,445,002 | 1,558,156 | 2,232,996 | fory |
-| NumericStructList | 反序列化 | 3,469,207 | 1,026,402 | 1,424,322 | fory |
-| SampleList | 序列化 | 829,415 | 280,973 | 536,448 | fory |
-| SampleList | 反序列化 | 1,117,133 | 175,122 | 362,663 | fory |
-| MediaContentList | 序列化 | 668,732 | 404,272 | 551,755 | fory |
-| MediaContentList | 反序列化 | 513,699 | 263,899 | 264,664 | fory |
-
-### 序列化数据大小(字节)
-
-| 数据类型 | fory | protobuf | msgpack |
-| ----------------- | ---- | -------- | ------- |
-| NumericStruct | 78 | 93 | 87 |
-| Sample | 445 | 460 | 562 |
-| MediaContent | 362 | 307 | 479 |
-| NumericStructList | 255 | 475 | 444 |
-| SampleList | 1978 | 2315 | 2819 |
-| MediaContentList | 1531 | 1550 | 2404 |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/csharp/throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/csharp/throughput.png
deleted file mode 100644
index 2c6c7bdd8c..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/csharp/throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/dart/throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/dart/throughput.png
deleted file mode 100644
index ee3833d8bc..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/dart/throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/benchmark_results.txt b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/benchmark_results.txt
deleted file mode 100644
index 9f471bc01f..0000000000
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/benchmark_results.txt
+++ /dev/null
@@ -1,326 +0,0 @@
-============================================
-Serialized Sizes (bytes):
-============================================
-NumericStruct:
- Fory: 78 bytes
- Protobuf: 93 bytes
- Msgpack: 88 bytes
-Sample:
- Fory: 445 bytes
- Protobuf: 375 bytes
- Msgpack: 524 bytes
-MediaContent:
- Fory: 340 bytes
- Protobuf: 301 bytes
- Msgpack: 400 bytes
-NumericStructList:
- Fory: 819 bytes
- Protobuf: 1900 bytes
- Msgpack: 1766 bytes
-SampleList:
- Fory: 7599 bytes
- Protobuf: 7560 bytes
- Msgpack: 10486 bytes
-MediaContentList:
- Fory: 5774 bytes
- Protobuf: 6080 bytes
- Msgpack: 8006 bytes
-============================================
-============================================
-Serialized Sizes (bytes):
-============================================
-NumericStruct:
- Fory: 78 bytes
- Protobuf: 93 bytes
- Msgpack: 88 bytes
-Sample:
- Fory: 445 bytes
- Protobuf: 375 bytes
- Msgpack: 524 bytes
-MediaContent:
- Fory: 340 bytes
- Protobuf: 301 bytes
- Msgpack: 400 bytes
-NumericStructList:
- Fory: 819 bytes
- Protobuf: 1900 bytes
- Msgpack: 1766 bytes
-SampleList:
- Fory: 7599 bytes
- Protobuf: 7560 bytes
- Msgpack: 10486 bytes
-MediaContentList:
- Fory: 5774 bytes
- Protobuf: 6080 bytes
- Msgpack: 8006 bytes
-============================================
-============================================
-Serialized Sizes (bytes):
-============================================
-NumericStruct:
- Fory: 78 bytes
- Protobuf: 93 bytes
- Msgpack: 88 bytes
-Sample:
- Fory: 445 bytes
- Protobuf: 375 bytes
- Msgpack: 524 bytes
-MediaContent:
- Fory: 340 bytes
- Protobuf: 301 bytes
- Msgpack: 400 bytes
-NumericStructList:
- Fory: 819 bytes
- Protobuf: 1900 bytes
- Msgpack: 1766 bytes
-SampleList:
- Fory: 7599 bytes
- Protobuf: 7560 bytes
- Msgpack: 10486 bytes
-MediaContentList:
- Fory: 5774 bytes
- Protobuf: 6080 bytes
- Msgpack: 8006 bytes
-============================================
-============================================
-Serialized Sizes (bytes):
-============================================
-NumericStruct:
- Fory: 78 bytes
- Protobuf: 93 bytes
- Msgpack: 88 bytes
-Sample:
- Fory: 445 bytes
- Protobuf: 375 bytes
- Msgpack: 524 bytes
-MediaContent:
- Fory: 340 bytes
- Protobuf: 301 bytes
- Msgpack: 400 bytes
-NumericStructList:
- Fory: 819 bytes
- Protobuf: 1900 bytes
- Msgpack: 1766 bytes
-SampleList:
- Fory: 7599 bytes
- Protobuf: 7560 bytes
- Msgpack: 10486 bytes
-MediaContentList:
- Fory: 5774 bytes
- Protobuf: 6080 bytes
- Msgpack: 8006 bytes
-============================================
-============================================
-Serialized Sizes (bytes):
-============================================
-NumericStruct:
- Fory: 78 bytes
- Protobuf: 93 bytes
- Msgpack: 88 bytes
-Sample:
- Fory: 445 bytes
- Protobuf: 375 bytes
- Msgpack: 524 bytes
-MediaContent:
- Fory: 340 bytes
- Protobuf: 301 bytes
- Msgpack: 400 bytes
-NumericStructList:
- Fory: 819 bytes
- Protobuf: 1900 bytes
- Msgpack: 1766 bytes
-SampleList:
- Fory: 7599 bytes
- Protobuf: 7560 bytes
- Msgpack: 10486 bytes
-MediaContentList:
- Fory: 5774 bytes
- Protobuf: 6080 bytes
- Msgpack: 8006 bytes
-============================================
-goos: darwin
-goarch: arm64
-pkg: github.com/apache/fory/benchmarks/go
-cpu: Apple M4 Pro
-BenchmarkFory_NumericStruct_Serialize-12 15385461 78.49 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_NumericStruct_Serialize-12 14953550 78.78 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_NumericStruct_Serialize-12 15520209 76.33 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_NumericStruct_Serialize-12 15806354 76.43 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_NumericStruct_Serialize-12 15314667 78.51 ns/op 0 B/op 0 allocs/op
-BenchmarkProtobuf_NumericStruct_Serialize-12 8704411 138.0 ns/op 192 B/op 2 allocs/op
-BenchmarkProtobuf_NumericStruct_Serialize-12 8522941 138.8 ns/op 192 B/op 2 allocs/op
-BenchmarkProtobuf_NumericStruct_Serialize-12 8285118 138.9 ns/op 192 B/op 2 allocs/op
-BenchmarkProtobuf_NumericStruct_Serialize-12 8818959 139.6 ns/op 192 B/op 2 allocs/op
-BenchmarkProtobuf_NumericStruct_Serialize-12 8463876 139.6 ns/op 192 B/op 2 allocs/op
-BenchmarkMsgpack_NumericStruct_Serialize-12 4396588 274.9 ns/op 240 B/op 3 allocs/op
-BenchmarkMsgpack_NumericStruct_Serialize-12 4438035 272.7 ns/op 240 B/op 3 allocs/op
-BenchmarkMsgpack_NumericStruct_Serialize-12 4352302 272.0 ns/op 240 B/op 3 allocs/op
-BenchmarkMsgpack_NumericStruct_Serialize-12 4346308 277.3 ns/op 240 B/op 3 allocs/op
-BenchmarkMsgpack_NumericStruct_Serialize-12 4361384 275.5 ns/op 240 B/op 3 allocs/op
-BenchmarkFory_NumericStruct_Deserialize-12 12784374 95.10 ns/op 48 B/op 1 allocs/op
-BenchmarkFory_NumericStruct_Deserialize-12 12615007 94.35 ns/op 48 B/op 1 allocs/op
-BenchmarkFory_NumericStruct_Deserialize-12 12597256 94.07 ns/op 48 B/op 1 allocs/op
-BenchmarkFory_NumericStruct_Deserialize-12 12663748 93.35 ns/op 48 B/op 1 allocs/op
-BenchmarkFory_NumericStruct_Deserialize-12 12668444 94.05 ns/op 48 B/op 1 allocs/op
-BenchmarkProtobuf_NumericStruct_Deserialize-12 9892239 157.3 ns/op 96 B/op 1 allocs/op
-BenchmarkProtobuf_NumericStruct_Deserialize-12 6950502 152.1 ns/op 96 B/op 1 allocs/op
-BenchmarkProtobuf_NumericStruct_Deserialize-12 7466115 210.2 ns/op 96 B/op 1 allocs/op
-BenchmarkProtobuf_NumericStruct_Deserialize-12 6987369 156.1 ns/op 96 B/op 1 allocs/op
-BenchmarkProtobuf_NumericStruct_Deserialize-12 10052640 119.0 ns/op 96 B/op 1 allocs/op
-BenchmarkMsgpack_NumericStruct_Deserialize-12 2397518 502.5 ns/op 96 B/op 2 allocs/op
-BenchmarkMsgpack_NumericStruct_Deserialize-12 2379376 501.1 ns/op 96 B/op 2 allocs/op
-BenchmarkMsgpack_NumericStruct_Deserialize-12 2390596 500.8 ns/op 96 B/op 2 allocs/op
-BenchmarkMsgpack_NumericStruct_Deserialize-12 2387790 504.9 ns/op 96 B/op 2 allocs/op
-BenchmarkMsgpack_NumericStruct_Deserialize-12 2404051 562.5 ns/op 96 B/op 2 allocs/op
-BenchmarkFory_NumericStructList_Serialize-12 1000000 1081 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_NumericStructList_Serialize-12 1000000 1021 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_NumericStructList_Serialize-12 1293205 947.2 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_NumericStructList_Serialize-12 1278226 929.6 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_NumericStructList_Serialize-12 1316396 912.8 ns/op 0 B/op 0 allocs/op
-BenchmarkProtobuf_NumericStructList_Serialize-12 467838 2594 ns/op 4192 B/op 23 allocs/op
-BenchmarkProtobuf_NumericStructList_Serialize-12 462572 2743 ns/op 4192 B/op 23 allocs/op
-BenchmarkProtobuf_NumericStructList_Serialize-12 453700 2589 ns/op 4192 B/op 23 allocs/op
-BenchmarkProtobuf_NumericStructList_Serialize-12 460408 2607 ns/op 4192 B/op 23 allocs/op
-BenchmarkProtobuf_NumericStructList_Serialize-12 452139 2594 ns/op 4192 B/op 23 allocs/op
-BenchmarkMsgpack_NumericStructList_Serialize-12 247603 4879 ns/op 4106 B/op 8 allocs/op
-BenchmarkMsgpack_NumericStructList_Serialize-12 249087 4844 ns/op 4106 B/op 8 allocs/op
-BenchmarkMsgpack_NumericStructList_Serialize-12 248340 5142 ns/op 4106 B/op 8 allocs/op
-BenchmarkMsgpack_NumericStructList_Serialize-12 206158 5846 ns/op 4106 B/op 8 allocs/op
-BenchmarkMsgpack_NumericStructList_Serialize-12 238311 4970 ns/op 4106 B/op 8 allocs/op
-BenchmarkFory_NumericStructList_Deserialize-12 1311939 932.1 ns/op 1072 B/op 3 allocs/op
-BenchmarkFory_NumericStructList_Deserialize-12 1313912 937.1 ns/op 1072 B/op 3 allocs/op
-BenchmarkFory_NumericStructList_Deserialize-12 1315593 915.4 ns/op 1072 B/op 3 allocs/op
-BenchmarkFory_NumericStructList_Deserialize-12 1311540 927.6 ns/op 1072 B/op 3 allocs/op
-BenchmarkFory_NumericStructList_Deserialize-12 1292565 919.9 ns/op 1072 B/op 3 allocs/op
-BenchmarkProtobuf_NumericStructList_Deserialize-12 447052 2745 ns/op 3512 B/op 28 allocs/op
-BenchmarkProtobuf_NumericStructList_Deserialize-12 429406 2743 ns/op 3512 B/op 28 allocs/op
-BenchmarkProtobuf_NumericStructList_Deserialize-12 438819 2706 ns/op 3512 B/op 28 allocs/op
-BenchmarkProtobuf_NumericStructList_Deserialize-12 447928 2785 ns/op 3512 B/op 28 allocs/op
-BenchmarkProtobuf_NumericStructList_Deserialize-12 447502 2721 ns/op 3512 B/op 28 allocs/op
-BenchmarkMsgpack_NumericStructList_Deserialize-12 122101 9764 ns/op 2193 B/op 7 allocs/op
-BenchmarkMsgpack_NumericStructList_Deserialize-12 123258 9896 ns/op 2193 B/op 7 allocs/op
-BenchmarkMsgpack_NumericStructList_Deserialize-12 121612 9738 ns/op 2193 B/op 7 allocs/op
-BenchmarkMsgpack_NumericStructList_Deserialize-12 124760 9670 ns/op 2193 B/op 7 allocs/op
-BenchmarkMsgpack_NumericStructList_Deserialize-12 125086 9698 ns/op 2193 B/op 7 allocs/op
-BenchmarkFory_Sample_Serialize-12 8696760 147.5 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_Sample_Serialize-12 8567470 181.8 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_Sample_Serialize-12 8293867 139.5 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_Sample_Serialize-12 8486005 140.6 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_Sample_Serialize-12 8506568 139.6 ns/op 0 B/op 0 allocs/op
-BenchmarkProtobuf_Sample_Serialize-12 3011733 387.9 ns/op 704 B/op 2 allocs/op
-BenchmarkProtobuf_Sample_Serialize-12 3108796 390.8 ns/op 704 B/op 2 allocs/op
-BenchmarkProtobuf_Sample_Serialize-12 2547630 393.6 ns/op 704 B/op 2 allocs/op
-BenchmarkProtobuf_Sample_Serialize-12 3026661 392.1 ns/op 704 B/op 2 allocs/op
-BenchmarkProtobuf_Sample_Serialize-12 3128582 395.9 ns/op 704 B/op 2 allocs/op
-BenchmarkMsgpack_Sample_Serialize-12 777014 1553 ns/op 2321 B/op 7 allocs/op
-BenchmarkMsgpack_Sample_Serialize-12 775314 1520 ns/op 2321 B/op 7 allocs/op
-BenchmarkMsgpack_Sample_Serialize-12 757838 1525 ns/op 2321 B/op 7 allocs/op
-BenchmarkMsgpack_Sample_Serialize-12 802612 1757 ns/op 2321 B/op 7 allocs/op
-BenchmarkMsgpack_Sample_Serialize-12 790094 1549 ns/op 2321 B/op 7 allocs/op
-BenchmarkFory_Sample_Deserialize-12 4167534 327.9 ns/op 676 B/op 9 allocs/op
-BenchmarkFory_Sample_Deserialize-12 3184602 338.0 ns/op 676 B/op 9 allocs/op
-BenchmarkFory_Sample_Deserialize-12 3629605 301.8 ns/op 676 B/op 9 allocs/op
-BenchmarkFory_Sample_Deserialize-12 4008093 302.2 ns/op 676 B/op 9 allocs/op
-BenchmarkFory_Sample_Deserialize-12 3992972 306.0 ns/op 676 B/op 9 allocs/op
-BenchmarkProtobuf_Sample_Deserialize-12 2527548 477.1 ns/op 708 B/op 9 allocs/op
-BenchmarkProtobuf_Sample_Deserialize-12 2476074 474.8 ns/op 708 B/op 9 allocs/op
-BenchmarkProtobuf_Sample_Deserialize-12 2532358 475.8 ns/op 708 B/op 9 allocs/op
-BenchmarkProtobuf_Sample_Deserialize-12 2408528 473.0 ns/op 708 B/op 9 allocs/op
-BenchmarkProtobuf_Sample_Deserialize-12 2482132 475.9 ns/op 708 B/op 9 allocs/op
-BenchmarkMsgpack_Sample_Deserialize-12 415698 2893 ns/op 1576 B/op 38 allocs/op
-BenchmarkMsgpack_Sample_Deserialize-12 417212 2950 ns/op 1576 B/op 38 allocs/op
-BenchmarkMsgpack_Sample_Deserialize-12 424497 2879 ns/op 1576 B/op 38 allocs/op
-BenchmarkMsgpack_Sample_Deserialize-12 417026 2953 ns/op 1576 B/op 38 allocs/op
-BenchmarkMsgpack_Sample_Deserialize-12 418338 2919 ns/op 1576 B/op 38 allocs/op
-BenchmarkFory_SampleList_Serialize-12 599605 2041 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_SampleList_Serialize-12 582406 2046 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_SampleList_Serialize-12 563160 2029 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_SampleList_Serialize-12 607074 2067 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_SampleList_Serialize-12 613364 2018 ns/op 0 B/op 0 allocs/op
-BenchmarkProtobuf_SampleList_Serialize-12 145861 8291 ns/op 14816 B/op 23 allocs/op
-BenchmarkProtobuf_SampleList_Serialize-12 150979 7938 ns/op 14816 B/op 23 allocs/op
-BenchmarkProtobuf_SampleList_Serialize-12 144135 8049 ns/op 14816 B/op 23 allocs/op
-BenchmarkProtobuf_SampleList_Serialize-12 149202 8469 ns/op 14816 B/op 23 allocs/op
-BenchmarkProtobuf_SampleList_Serialize-12 152338 7927 ns/op 14816 B/op 23 allocs/op
-BenchmarkMsgpack_SampleList_Serialize-12 43825 27705 ns/op 32793 B/op 11 allocs/op
-BenchmarkMsgpack_SampleList_Serialize-12 43051 29707 ns/op 32793 B/op 11 allocs/op
-BenchmarkMsgpack_SampleList_Serialize-12 42046 27699 ns/op 32793 B/op 11 allocs/op
-BenchmarkMsgpack_SampleList_Serialize-12 42596 37501 ns/op 32793 B/op 11 allocs/op
-BenchmarkMsgpack_SampleList_Serialize-12 42518 27909 ns/op 32793 B/op 11 allocs/op
-BenchmarkFory_SampleList_Deserialize-12 249300 4817 ns/op 13952 B/op 163 allocs/op
-BenchmarkFory_SampleList_Deserialize-12 245127 5156 ns/op 13952 B/op 163 allocs/op
-BenchmarkFory_SampleList_Deserialize-12 247790 4943 ns/op 13952 B/op 163 allocs/op
-BenchmarkFory_SampleList_Deserialize-12 249534 4934 ns/op 13952 B/op 163 allocs/op
-BenchmarkFory_SampleList_Deserialize-12 239244 5126 ns/op 13952 B/op 163 allocs/op
-BenchmarkProtobuf_SampleList_Deserialize-12 111327 10797 ns/op 20872 B/op 188 allocs/op
-BenchmarkProtobuf_SampleList_Deserialize-12 109178 10919 ns/op 20872 B/op 188 allocs/op
-BenchmarkProtobuf_SampleList_Deserialize-12 92876 12674 ns/op 20872 B/op 188 allocs/op
-BenchmarkProtobuf_SampleList_Deserialize-12 108414 10816 ns/op 20872 B/op 188 allocs/op
-BenchmarkProtobuf_SampleList_Deserialize-12 114196 10460 ns/op 20872 B/op 188 allocs/op
-BenchmarkMsgpack_SampleList_Deserialize-12 20566 58400 ns/op 37251 B/op 727 allocs/op
-BenchmarkMsgpack_SampleList_Deserialize-12 20526 65792 ns/op 37251 B/op 727 allocs/op
-BenchmarkMsgpack_SampleList_Deserialize-12 20550 58213 ns/op 37251 B/op 727 allocs/op
-BenchmarkMsgpack_SampleList_Deserialize-12 19180 58170 ns/op 37251 B/op 727 allocs/op
-BenchmarkMsgpack_SampleList_Deserialize-12 20426 60118 ns/op 37251 B/op 727 allocs/op
-BenchmarkFory_MediaContent_Serialize-12 4481811 268.2 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_MediaContent_Serialize-12 4470292 269.4 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_MediaContent_Serialize-12 4524715 269.0 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_MediaContent_Serialize-12 4516789 270.0 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_MediaContent_Serialize-12 4391221 267.3 ns/op 0 B/op 0 allocs/op
-BenchmarkProtobuf_MediaContent_Serialize-12 2135143 544.6 ns/op 1144 B/op 11 allocs/op
-BenchmarkProtobuf_MediaContent_Serialize-12 2160157 561.0 ns/op 1144 B/op 11 allocs/op
-BenchmarkProtobuf_MediaContent_Serialize-12 2221641 545.3 ns/op 1144 B/op 11 allocs/op
-BenchmarkProtobuf_MediaContent_Serialize-12 2214582 565.7 ns/op 1144 B/op 11 allocs/op
-BenchmarkProtobuf_MediaContent_Serialize-12 2115079 571.6 ns/op 1144 B/op 11 allocs/op
-BenchmarkMsgpack_MediaContent_Serialize-12 1380163 869.0 ns/op 1168 B/op 6 allocs/op
-BenchmarkMsgpack_MediaContent_Serialize-12 1380481 874.4 ns/op 1168 B/op 6 allocs/op
-BenchmarkMsgpack_MediaContent_Serialize-12 1369536 873.7 ns/op 1168 B/op 6 allocs/op
-BenchmarkMsgpack_MediaContent_Serialize-12 1376877 881.8 ns/op 1168 B/op 6 allocs/op
-BenchmarkMsgpack_MediaContent_Serialize-12 1381296 875.1 ns/op 1168 B/op 6 allocs/op
-BenchmarkFory_MediaContent_Deserialize-12 2537758 474.9 ns/op 656 B/op 13 allocs/op
-BenchmarkFory_MediaContent_Deserialize-12 2491048 478.2 ns/op 656 B/op 13 allocs/op
-BenchmarkFory_MediaContent_Deserialize-12 2500486 520.6 ns/op 656 B/op 13 allocs/op
-BenchmarkFory_MediaContent_Deserialize-12 2419058 495.7 ns/op 656 B/op 13 allocs/op
-BenchmarkFory_MediaContent_Deserialize-12 2404918 492.4 ns/op 656 B/op 13 allocs/op
-BenchmarkProtobuf_MediaContent_Deserialize-12 1852849 647.5 ns/op 1088 B/op 21 allocs/op
-BenchmarkProtobuf_MediaContent_Deserialize-12 1865282 638.1 ns/op 1088 B/op 21 allocs/op
-BenchmarkProtobuf_MediaContent_Deserialize-12 1873513 649.3 ns/op 1088 B/op 21 allocs/op
-BenchmarkProtobuf_MediaContent_Deserialize-12 1853527 635.6 ns/op 1088 B/op 21 allocs/op
-BenchmarkProtobuf_MediaContent_Deserialize-12 1729706 815.8 ns/op 1088 B/op 21 allocs/op
-BenchmarkMsgpack_MediaContent_Deserialize-12 801156 1553 ns/op 896 B/op 17 allocs/op
-BenchmarkMsgpack_MediaContent_Deserialize-12 787426 1520 ns/op 896 B/op 17 allocs/op
-BenchmarkMsgpack_MediaContent_Deserialize-12 750510 1538 ns/op 896 B/op 17 allocs/op
-BenchmarkMsgpack_MediaContent_Deserialize-12 803448 1543 ns/op 896 B/op 17 allocs/op
-BenchmarkMsgpack_MediaContent_Deserialize-12 780190 1549 ns/op 896 B/op 17 allocs/op
-BenchmarkFory_MediaContentList_Serialize-12 304236 4158 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_MediaContentList_Serialize-12 300002 4008 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_MediaContentList_Serialize-12 301590 4026 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_MediaContentList_Serialize-12 304356 3955 ns/op 0 B/op 0 allocs/op
-BenchmarkFory_MediaContentList_Serialize-12 305937 4006 ns/op 0 B/op 0 allocs/op
-BenchmarkProtobuf_MediaContentList_Serialize-12 113460 10919 ns/op 22848 B/op 203 allocs/op
-BenchmarkProtobuf_MediaContentList_Serialize-12 105204 12060 ns/op 22848 B/op 203 allocs/op
-BenchmarkProtobuf_MediaContentList_Serialize-12 112503 10890 ns/op 22848 B/op 203 allocs/op
-BenchmarkProtobuf_MediaContentList_Serialize-12 110593 10468 ns/op 22848 B/op 203 allocs/op
-BenchmarkProtobuf_MediaContentList_Serialize-12 112423 10939 ns/op 22848 B/op 203 allocs/op
-BenchmarkMsgpack_MediaContentList_Serialize-12 77541 15641 ns/op 16881 B/op 30 allocs/op
-BenchmarkMsgpack_MediaContentList_Serialize-12 77178 16293 ns/op 16880 B/op 30 allocs/op
-BenchmarkMsgpack_MediaContentList_Serialize-12 73228 16168 ns/op 16880 B/op 30 allocs/op
-BenchmarkMsgpack_MediaContentList_Serialize-12 71780 16275 ns/op 16880 B/op 30 allocs/op
-BenchmarkMsgpack_MediaContentList_Serialize-12 77145 17553 ns/op 16881 B/op 30 allocs/op
-BenchmarkFory_MediaContentList_Deserialize-12 146653 8254 ns/op 13040 B/op 243 allocs/op
-BenchmarkFory_MediaContentList_Deserialize-12 145420 8133 ns/op 13040 B/op 243 allocs/op
-BenchmarkFory_MediaContentList_Deserialize-12 148918 8145 ns/op 13040 B/op 243 allocs/op
-BenchmarkFory_MediaContentList_Deserialize-12 141998 8498 ns/op 13040 B/op 243 allocs/op
-BenchmarkFory_MediaContentList_Deserialize-12 138174 8893 ns/op 13040 B/op 243 allocs/op
-BenchmarkProtobuf_MediaContentList_Deserialize-12 90056 13521 ns/op 25400 B/op 428 allocs/op
-BenchmarkProtobuf_MediaContentList_Deserialize-12 82902 13638 ns/op 25400 B/op 428 allocs/op
-BenchmarkProtobuf_MediaContentList_Deserialize-12 91242 14083 ns/op 25400 B/op 428 allocs/op
-BenchmarkProtobuf_MediaContentList_Deserialize-12 85706 13089 ns/op 25400 B/op 428 allocs/op
-BenchmarkProtobuf_MediaContentList_Deserialize-12 91342 13588 ns/op 25400 B/op 428 allocs/op
-BenchmarkMsgpack_MediaContentList_Deserialize-12 33295 31198 ns/op 20058 B/op 307 allocs/op
-BenchmarkMsgpack_MediaContentList_Deserialize-12 40077 31423 ns/op 20058 B/op 307 allocs/op
-BenchmarkMsgpack_MediaContentList_Deserialize-12 39219 30604 ns/op 20058 B/op 307 allocs/op
-BenchmarkMsgpack_MediaContentList_Deserialize-12 39799 30377 ns/op 20058 B/op 307 allocs/op
-BenchmarkMsgpack_MediaContentList_Deserialize-12 39267 32439 ns/op 20058 B/op 307 allocs/op
-PASS
-ok github.com/apache/fory/benchmarks/go 268.327s
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/serialized_sizes.txt b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/serialized_sizes.txt
deleted file mode 100644
index a64d3e1c05..0000000000
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/serialized_sizes.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-Serialized Sizes (bytes):
-============================================
-NumericStruct:
- Fory: 78 bytes
- Protobuf: 93 bytes
- Msgpack: 88 bytes
-Sample:
- Fory: 445 bytes
- Protobuf: 375 bytes
- Msgpack: 524 bytes
-MediaContent:
- Fory: 340 bytes
- Protobuf: 301 bytes
- Msgpack: 400 bytes
-NumericStructList:
- Fory: 819 bytes
- Protobuf: 1900 bytes
- Msgpack: 1766 bytes
-SampleList:
- Fory: 7599 bytes
- Protobuf: 7560 bytes
- Msgpack: 10486 bytes
-MediaContentList:
- Fory: 5774 bytes
- Protobuf: 6080 bytes
- Msgpack: 8006 bytes
-============================================
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/throughput.png
deleted file mode 100644
index 086d8b5533..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/index.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/index.md
new file mode 100644
index 0000000000..d63eefe240
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/index.md
@@ -0,0 +1,126 @@
+---
+title: 基准测试
+sidebar_position: 1
+id: index
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+> **注意**:不同序列化器和配置各自擅长不同的工作负载。基准测试结果仅供参考。
+> 请针对具体使用场景,采用适当的配置和工作负载进行基准测试。
+
+## Java 基准测试
+
+Java 基准测试使用 `docs/benchmarks/object-serialization/native/java` 中的当前测试套件,
+将 Fory 与常见 Java 序列化框架进行比较。
+
+**序列化吞吐量**:
+
+
+
+**反序列化吞吐量**:
+
+
+
+**JSON 吞吐量**:
+
+<div style={{display: 'flex', gap: '1rem'}}>
+ <img src={require('./json/java/string_throughput.png').default} alt="Java JSON String Throughput" style={{width: 'calc(50% - 0.5rem)'}} />
+ <img src={require('./json/java/utf8_bytes_throughput.png').default} alt="Java JSON UTF-8 Throughput" style={{width: 'calc(50% - 0.5rem)'}} />
+</div>
+
+**跨语言吞吐量**:
+
+
+
+**重要**:测量 Fory 运行时代码生成性能时,需要进行充分预热:
+
+更多基准测试说明、原始数据和完整 Java benchmark README,请参阅 [Java 基准测试](object-serialization/native/java/README.md)。
+
+## Python 基准测试
+
+在对象和列表工作负载中,Fory Python 相比 `pickle` 和 Protobuf 展现出优秀性能。
+
+
+
+基准测试设置、原始结果和复现步骤请参阅 [Python 基准测试](object-serialization/xlang/python/README.md)。
+
+## Rust 基准测试
+
+与其他 Rust 序列化框架相比,Fory Rust 展现出有竞争力的性能。
+
+
+
+注意:结果取决于硬件、数据集和实现版本。记录的环境、工作负载和复现命令请参阅
+[Rust 基准测试报告](object-serialization/xlang/rust/README.md)。
+
+## C++ 基准测试
+
+与 Protobuf C++ 序列化框架相比,Fory C++ 展现出有竞争力的性能。
+
+
+
+记录的环境、工作负载和复现命令请参阅 [C++ 基准测试报告](object-serialization/xlang/cpp/README.md)。
+
+## Go 基准测试
+
+在单对象和列表工作负载中,Fory Go 相比 Protobuf 和 Msgpack 展现出优秀性能。
+
+
+
+注意:结果取决于硬件、数据集和实现版本。详情请参阅
+[Go 基准测试报告](object-serialization/xlang/go/README.md)。
+
+## C# 基准测试
+
+在有类型对象的序列化和反序列化工作负载中,Fory C# 相比 Protobuf 和 Msgpack 展现出优秀性能。
+
+
+
+注意:结果取决于硬件和运行时版本。详情请参阅
+[C# 基准测试报告](object-serialization/xlang/csharp/README.md)。
+
+## Swift 基准测试
+
+在标量对象和列表工作负载中,Fory Swift 相比 Protobuf 和 Msgpack 展现出优秀性能。
+
+
+
+注意:结果取决于硬件和运行时版本。详情请参阅
+[Swift 基准测试报告](object-serialization/xlang/swift/README.md)。
+
+## JavaScript 基准测试
+
+在具有代表性的 Node.js 工作负载中,Fory JavaScript 相比 Protocol Buffers 和 JSON 展现出优秀性能。
+
+
+
+注意:结果取决于硬件、数据集和运行时版本。详情请参阅
+[JavaScript 基准测试报告](object-serialization/xlang/javascript/README.md)。
+
+## Dart 基准测试
+
+在具有代表性的对象和列表工作负载中,Fory Dart 相比 Protocol Buffers 展现出优秀性能。
+
+
+
+注意:结果取决于硬件、数据集和运行时版本。详情请参阅
+[Dart 基准测试报告](object-serialization/xlang/dart/README.md)。
+
+## 正确解读结果
+
+请先阅读[方法论](methodology.md),再打开能力、运行时、Schema、模式和操作均与自身工作负载匹配的报告。
+仓库中保存的结果只是其记录环境下的历史证据,并不保证适用于其他应用或当前 main 分支。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/data/jmh-jdk-11-deserialization.csv b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/data/jmh-jdk-11-deserialization.csv
deleted file mode 100644
index 98760a4721..0000000000
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/data/jmh-jdk-11-deserialization.csv
+++ /dev/null
@@ -1,153 +0,0 @@
-"Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: bufferType","Param: objectType","Param: references"
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,473409.796491,250793.361170,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,428315.502365,191770.682411,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,363455.785182,44717.666948,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,304371.728638,74831.791688,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,357887.235311,218092.594151,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,353480.554035,229239.505256,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,280131.091068,89472.347221,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,260649.308016,165597.762734,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,441027.550809,321712.847983,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,420523.770904,122531.658151,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,311691.658687,185300.664992,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,251820.171513,894743.730727,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,352441.597147,109488.413174,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,334574.303484,89858.329407,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,262519.858810,138990.948859,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fst_deserialize","thrpt",1,3,234973.637096,568162.582389,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,2069988.624415,1501625.089719,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,1797942.442313,3541577.357052,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,2054066.903469,3314161.094630,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,1507767.206603,1662320.958961,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,4595230.434552,678411.427346,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,4634753.596131,582102.492158,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,1126298.359550,856691.704987,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,1046649.083082,1816153.563648,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,2229791.078395,2950833.975767,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,1958815.397807,381903.427430,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,1502746.028159,1759759.267183,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,1290593.975753,246089.810346,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,5012002.859236,3360944.705659,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,4864329.316938,4357833.300692,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,1117586.457565,323438.118804,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize","thrpt",1,3,1018277.848128,1141314.435153,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,2296046.895861,2532372.600048,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,1834139.395757,1021897.505849,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,1441671.706320,317052.609754,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,1121136.039627,979316.642796,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,2110335.039275,389404.889706,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,2135681.982674,1140328.709799,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,849507.176263,77466.989680,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,815120.319155,110547.743648,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,2308111.633661,1699117.497565,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,1820490.585648,244290.391445,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,1256034.732514,811833.294307,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,1054942.751816,180122.424477,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,1596464.248141,1624412.248391,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,1684681.074242,865262.572050,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,784036.589363,189745.805570,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.fory_deserialize_compatible","thrpt",1,3,782679.662083,232459.929272,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,2485564.396196,404678.689647,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,2002938.794909,254819.284313,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,2279742.810882,1984221.778254,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,1623938.202345,902985.831204,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,4978833.206806,1201415.339844,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,4807963.882520,981981.561987,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,1201998.142474,446807.356524,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,1058423.614156,2254684.330438,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,2289261.533644,330913.304260,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,1927548.827586,2169684.221478,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,1718098.363961,1096276.962216,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,1333345.536684,1110700.750020,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,5149070.657830,3249519.880480,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,5137500.621288,3988987.937014,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,1131212.586953,240674.468318,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.forymetashared_deserialize_compatible","thrpt",1,3,1089162.408165,294119.059967,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,119471.518388,29846.632785,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,121106.002978,27710.578092,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,118156.072284,4767.841380,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,120016.594171,41255.986380,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,84709.108821,132894.355932,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,91050.370224,17939.461828,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,69758.767783,10886.276794,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,68616.029248,13625.851120,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,117806.916589,35449.535259,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,121940.783597,54381.355274,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,111067.942626,136178.034974,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,121820.821260,36972.450957,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,91151.633583,18401.579776,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,91037.205901,58868.732797,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,66866.108653,38522.707093,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize","thrpt",1,3,65338.345185,56556.914062,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,121898.105768,55415.594537,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,121297.485903,33990.621079,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,121619.090797,6094.683470,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,119994.104050,24538.128667,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,88617.486795,40076.835119,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,90206.654212,19313.248466,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,63703.763814,132184.298414,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,69521.573119,8875.645591,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,124044.417439,41135.181705,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,120276.449497,87827.771405,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,107594.474890,81084.454215,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,116531.023438,141591.979641,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,89580.561575,23464.095972,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,84407.472531,46007.731889,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,69342.030965,17706.784671,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.hession_deserialize_compatible","thrpt",1,3,68542.055543,31793.805138,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,29309.573998,765.998843,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,27466.003923,14896.452629,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,38536.250402,28217.590983,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,38957.191090,23931.545367,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,29603.066599,10373.666720,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,29727.744196,15820.774882,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,14888.805111,842.165916,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,14034.100664,13936.787605,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,28128.457935,5385.055284,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,28221.014735,15281.277719,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,40512.632076,8592.454839,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,37030.594632,9683.316145,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,28717.004518,17023.663871,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,29549.998286,13823.854047,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,14652.043788,2419.900104,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.jdk_deserialize","thrpt",1,3,14425.886048,8723.095052,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,979173.981159,178146.966897,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,716438.884369,623966.984928,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,577631.234369,221011.018380,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,365530.417232,214946.853015,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,607750.343557,99638.164976,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,552802.227807,126286.013177,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,275984.042401,9405.143983,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,222710.554833,45168.519253,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,983538.936801,1112062.949472,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,762889.302732,279678.610328,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,389473.174523,43058.395501,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,306995.220799,57411.579647,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,910534.169114,1888677.766640,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,914404.107564,357717.816934,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,319247.256793,217674.935649,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize","thrpt",1,3,249105.828416,131690.474985,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,255086.928308,23672.392381,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,238811.995510,18059.118666,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,180882.860363,69339.581545,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,154311.211540,23065.912064,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,78771.635309,45155.641241,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,72805.937649,16849.888437,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,60602.285743,61404.274046,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,62729.908347,32805.651539,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,201993.787890,41567.224827,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,174534.710870,96357.498949,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,134485.160300,104898.991148,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,119311.787329,66580.856795,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,58574.904225,140682.248378,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,60685.320299,24159.853451,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,54637.329134,14011.283798,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.kryo_deserialize_compatible","thrpt",1,3,51761.569591,61030.640534,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.protostuff_deserialize","thrpt",1,3,619338.385412,275705.847169,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.protostuff_deserialize","thrpt",1,3,951662.019963,165160.853007,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.protostuff_deserialize","thrpt",1,3,517381.168594,313746.662696,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.protostuff_deserialize","thrpt",1,3,416212.973861,119393.345217,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.protostuff_deserialize","thrpt",1,3,624804.978534,147685.682690,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.protostuff_deserialize","thrpt",1,3,964664.641598,218386.902856,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.protostuff_deserialize","thrpt",1,3,538922.947147,59168.303230,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeDeserializeSuite.protostuff_deserialize","thrpt",1,3,425523.315814,179264.359952,"ops/s",directBuffer,STRUCT2,false
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/data/jmh-jdk-11-serialization.csv b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/data/jmh-jdk-11-serialization.csv
deleted file mode 100644
index 2e985751a7..0000000000
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/data/jmh-jdk-11-serialization.csv
+++ /dev/null
@@ -1,153 +0,0 @@
-"Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: bufferType","Param: objectType","Param: references"
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,915907.574306,87627.907529,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,731869.156376,37845.555465,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,751892.023189,174327.010719,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,583859.907758,320047.618377,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,882178.995727,294884.724923,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,757753.756691,605180.489112,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,371762.982661,80513.482138,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,380638.700267,101974.434105,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,902302.261168,474054.277143,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,723614.066770,77429.645491,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,728001.080250,75699.111305,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,595679.580108,117269.848918,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,807847.663261,67842.801069,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,762088.935404,575559.070335,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,365317.705376,138313.634773,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fst_serialize","thrpt",1,3,370851.880711,66834.323719,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,3570966.469087,152949.902180,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,1767693.835090,263146.035836,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,3031642.924542,567213.986117,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,2250384.600246,529709.299207,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,7501415.567260,6672023.542025,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,6264439.154428,976363.317001,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,3586126.623874,1966282.728305,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,3306474.506382,869558.338568,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,3684487.760591,882227.920611,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,1826456.709478,1377648.673630,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,2479862.129632,1498299.302699,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,1938527.588331,148125.034055,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,9834223.243204,5284494.290641,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,7551780.823133,744016.111639,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,2643155.135327,200764.008652,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize","thrpt",1,3,2391110.083108,2608567.411194,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,3604596.465625,1232634.245435,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,1619648.337293,212055.067245,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,1679272.036223,788041.322785,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,1406736.538716,263608.222325,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,3530406.108869,3125642.741982,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,3293059.098127,96940.669016,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,2773368.997680,503239.905176,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,2564174.550276,978139.792610,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,3484533.218305,476583.192148,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,1730822.630648,410016.597939,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,1710680.937387,307207.222026,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,1149999.473994,140915.968294,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,2653169.568374,535312.987476,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,2393817.762938,380997.375838,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,1912402.937879,284090.793301,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.fory_serialize_compatible","thrpt",1,3,1848338.968058,108311.846780,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,4409055.687063,112740.443049,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,1840705.439334,516764.580627,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,2992288.235281,867622.163323,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,2058738.716953,2388681.798594,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,9204444.777172,1526628.258403,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,7064625.291374,2655795.498346,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,2575824.143864,2216634.295140,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,3543082.528217,393858.603613,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,5043538.364886,2797987.191909,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,1859289.705838,366893.710607,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,2291443.556971,3167882.958411,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,1804349.244125,481995.792041,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,11650229.648715,1101289.207239,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,8702412.752357,1116617.972427,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,2714748.572248,284462.787825,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.forymetashared_serialize_compatible","thrpt",1,3,1866073.031851,1521156.537508,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,220386.502846,60892.430853,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,192414.014211,34217.359956,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,367782.358049,54538.846197,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,329427.470680,530871.650379,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,258233.998931,145299.453488,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,260845.209485,90601.426407,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,56056.080075,3919.171009,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,60038.879790,6808.083631,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,220981.308085,153633.380796,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,211949.960255,231322.136517,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,372477.138150,39349.725456,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,353376.085025,11334.885856,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,266481.009225,113518.076189,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,261762.594966,64652.028148,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,55924.319442,28173.043405,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize","thrpt",1,3,56674.065604,2667.957614,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,234454.975158,5232.236462,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,206174.173039,54217.176504,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,377195.903772,33297.468886,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,351657.879556,10762.766962,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,258650.663523,64158.329095,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,263564.913879,101476.568014,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,58509.125342,10836.872797,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,55552.977735,37802.538138,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,194761.224263,8828.274695,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,212840.483308,50730.019909,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,371729.727192,136063.629978,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,343834.954942,13355.085558,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,249221.452137,261034.656030,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,263623.143601,32854.227410,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,58908.567439,4137.470432,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.hession_serialize_compatible","thrpt",1,3,55524.373547,668.406873,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,118374.836631,34704.407553,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,119858.140625,49308.850176,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,137989.198821,40017.148924,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,140260.668888,57308.595910,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,155908.244240,20385.278504,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,151258.539369,12676.385578,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,36846.049162,5491.880967,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,38183.705811,14778.659439,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,118273.584257,18950.629048,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,108263.040839,14982.910444,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,138567.623369,24365.255940,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,140158.673910,54416.908878,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,154875.908438,11984.781345,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,156404.686214,58131.602098,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,37444.967981,14948.012339,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.jdk_serialize","thrpt",1,3,35798.679246,36641.428549,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,1105365.931217,162251.803619,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,734215.482291,79297.387490,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,730792.521676,678674.266715,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,445251.084327,85646.179264,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,558194.100861,257156.321315,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,557542.628765,63084.390134,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,325172.969175,20774.334333,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,259863.332448,86373.633851,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,1376560.302168,147424.342310,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,932887.968348,249800.928765,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,608972.517580,249598.971835,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,359875.473951,274870.064607,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,1078046.011115,249527.480472,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,853350.408656,126642.692106,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,355688.882786,37587.645927,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize","thrpt",1,3,338960.426033,36185.446014,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,378907.663184,280309.649766,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,320815.567701,455179.720989,"ops/s",array,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,188911.259146,97827.317807,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,145782.916427,81270.905462,"ops/s",array,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,145964.199559,88578.667153,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,136180.832879,167433.069232,"ops/s",array,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,125807.748004,23178.451287,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,114983.546343,7341.380140,"ops/s",array,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,296102.615094,18485.738321,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,276757.392449,61173.636852,"ops/s",directBuffer,SAMPLE,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,185363.714829,121440.885632,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,142836.961878,12450.918452,"ops/s",directBuffer,MEDIA_CONTENT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,106695.800225,13463.570576,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,106458.212005,2994.065295,"ops/s",directBuffer,STRUCT,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,92130.672361,9515.661170,"ops/s",directBuffer,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.kryo_serialize_compatible","thrpt",1,3,88989.724768,9379.338279,"ops/s",directBuffer,STRUCT2,true
-"org.apache.fory.benchmark.UserTypeSerializeSuite.protostuff_serialize","thrpt",1,3,663272.710783,522116.492895,"ops/s",array,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.protostuff_serialize","thrpt",1,3,780618.761219,406063.945348,"ops/s",array,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.protostuff_serialize","thrpt",1,3,330975.350403,196475.862643,"ops/s",array,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.protostuff_serialize","thrpt",1,3,322563.440433,201276.713653,"ops/s",array,STRUCT2,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.protostuff_serialize","thrpt",1,3,693641.589806,43883.803566,"ops/s",directBuffer,SAMPLE,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.protostuff_serialize","thrpt",1,3,805941.345157,91281.699006,"ops/s",directBuffer,MEDIA_CONTENT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.protostuff_serialize","thrpt",1,3,340262.650047,152117.387028,"ops/s",directBuffer,STRUCT,false
-"org.apache.fory.benchmark.UserTypeSerializeSuite.protostuff_serialize","thrpt",1,3,325093.716261,56485.972228,"ops/s",directBuffer,STRUCT2,false
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/data/jmh-jdk-11-zerocopy.csv b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/data/jmh-jdk-11-zerocopy.csv
deleted file mode 100644
index 503298291f..0000000000
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/data/jmh-jdk-11-zerocopy.csv
+++ /dev/null
@@ -1,73 +0,0 @@
-"Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: array_size","Param: bufferType","Param: dataType","Param: references"
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,219333.990504,40075.312705,"ops/s",200,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,657754.887247,408901.031753,"ops/s",200,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,179604.045774,45387.509931,"ops/s",200,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,598421.278941,135411.381215,"ops/s",200,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,53100.903684,17709.358858,"ops/s",1000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,422147.154601,528539.529166,"ops/s",1000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,38572.001768,24685.893533,"ops/s",1000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,298929.116572,135040.133488,"ops/s",1000,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,10672.872798,11519.184075,"ops/s",5000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,136934.604328,19269.032565,"ops/s",5000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,8561.694533,2137.867210,"ops/s",5000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_deserialize","thrpt",1,3,77950.612503,83587.484192,"ops/s",5000,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,313986.053417,29311.641179,"ops/s",200,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,2400193.220466,242732.420524,"ops/s",200,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,294132.218623,60640.778775,"ops/s",200,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,2282550.111756,93004.652618,"ops/s",200,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,67209.107012,5947.935958,"ops/s",1000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,1805557.477810,5232839.112456,"ops/s",1000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,66108.014322,16869.542536,"ops/s",1000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,1644789.427010,54907.475118,"ops/s",1000,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,14997.400124,12425.308762,"ops/s",5000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,811029.402136,39593.863849,"ops/s",5000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,15000.378818,2219.583522,"ops/s",5000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fst_serialize","thrpt",1,3,477148.540850,34970.176073,"ops/s",5000,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,986136.067809,274606.792449,"ops/s",200,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,3302149.383135,3166455.521704,"ops/s",200,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,991807.969328,296490.837932,"ops/s",200,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,3113115.471758,4861106.592529,"ops/s",200,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,205671.992736,127494.951753,"ops/s",1000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,2831942.848999,1720214.698856,"ops/s",1000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,202275.242341,56270.238293,"ops/s",1000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,3397690.327371,146058.097383,"ops/s",1000,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,40312.590172,11836.614114,"ops/s",5000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,3296658.120035,2199676.238015,"ops/s",5000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,40413.743717,9893.735875,"ops/s",5000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_deserialize","thrpt",1,3,3284441.570594,998247.999163,"ops/s",5000,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,8297232.942927,6613235.386482,"ops/s",200,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,5123572.914045,9342104.794019,"ops/s",200,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,8335248.350301,2796789.944593,"ops/s",200,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,5400346.890126,7654935.504676,"ops/s",200,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,8772856.921028,1984208.178343,"ops/s",1000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,4979590.929127,5568756.926202,"ops/s",1000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,8207563.785251,4153794.222735,"ops/s",1000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,5376191.775007,9167580.616022,"ops/s",1000,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,8027439.580226,6148996.477681,"ops/s",5000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,5018916.322770,1424045.598203,"ops/s",5000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,7695981.988316,578662.201123,"ops/s",5000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.fory_serialize","thrpt",1,3,5330897.682960,8055585.038901,"ops/s",5000,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,146675.360652,23502.675233,"ops/s",200,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,1296284.787720,297204.673569,"ops/s",200,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,518713.299422,600548.228171,"ops/s",200,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,1004844.498712,552313.083272,"ops/s",200,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,30409.835023,9562.322209,"ops/s",1000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,721266.541130,62426.822891,"ops/s",1000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,112132.004609,6625.327605,"ops/s",1000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,592972.713203,511777.226637,"ops/s",1000,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,6122.351228,3021.683209,"ops/s",5000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,147251.846111,278375.379465,"ops/s",5000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,21826.040410,2246.004993,"ops/s",5000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_deserialize","thrpt",1,3,148614.476829,87146.409451,"ops/s",5000,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,147342.606262,138864.952435,"ops/s",200,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,1985187.977633,70426.638387,"ops/s",200,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,972683.763633,604464.052899,"ops/s",200,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,1739454.519770,1053963.541481,"ops/s",200,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,31395.721514,3652.506399,"ops/s",1000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,1616159.671230,2722436.839807,"ops/s",1000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,209183.090868,25323.702489,"ops/s",1000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,1377272.568510,203974.331559,"ops/s",1000,directBuffer,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,6248.006967,783.226602,"ops/s",5000,array,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,711287.533377,86363.201941,"ops/s",5000,array,BUFFER,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,43565.678616,4221.267495,"ops/s",5000,directBuffer,PRIMITIVE_ARRAY,false
-"org.apache.fory.benchmark.ZeroCopySuite.kryo_serialize","thrpt",1,3,707092.956534,298737.951680,"ops/s",5000,directBuffer,BUFFER,false
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_deserialize_compatible.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_deserialize_compatible.png
deleted file mode 100644
index 52dd292a3c..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_deserialize_compatible.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_deserialize_consistent.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_deserialize_consistent.png
deleted file mode 100644
index a21445421a..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_deserialize_consistent.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_serialize_compatible.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_serialize_compatible.png
deleted file mode 100644
index 2142dfdbab..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_serialize_compatible.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_serialize_consistent.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_serialize_consistent.png
deleted file mode 100644
index 5703f72473..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_heap_serialize_consistent.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_deserialize_compatible.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_deserialize_compatible.png
deleted file mode 100644
index ce77bf6fb7..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_deserialize_compatible.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_deserialize_consistent.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_deserialize_consistent.png
deleted file mode 100644
index 04c3e3d04a..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_deserialize_consistent.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_serialize_compatible.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_serialize_compatible.png
deleted file mode 100644
index 8d9197121c..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_serialize_compatible.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_serialize_consistent.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_serialize_consistent.png
deleted file mode 100644
index 8bdea8f559..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_offheap_serialize_consistent.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_repo_deserialization_throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_repo_deserialization_throughput.png
deleted file mode 100644
index d64f5e77a1..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_repo_deserialization_throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_repo_serialization_throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_repo_serialization_throughput.png
deleted file mode 100644
index 8f9824ffe1..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_repo_serialization_throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_zero_copy_deserialize.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_zero_copy_deserialize.png
deleted file mode 100644
index a91315eb34..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_zero_copy_deserialize.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_zero_copy_serialize.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_zero_copy_serialize.png
deleted file mode 100644
index a3f1b98346..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/java_zero_copy_serialize.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/json/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/json/README.md
deleted file mode 100644
index 369974c4a7..0000000000
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/json/README.md
+++ /dev/null
@@ -1,38 +0,0 @@
-# Java JSON 基准报告
-
-该基准使用相同的数据比较 fory-json、Jackson 和 Gson。String 组不包含 UTF-8 转换。UTF-8
-字节组会在可用时直接使用字节数组 API。Gson 的结果包含从 String 到 UTF-8 的编码,以及从
-UTF-8 到 String 的解码。
-
-```bash
-cd benchmarks/java
-./run_json.sh --libs fory-json,jackson,gson
-```
-
-- 基准日期:`2026-07-28`
-- 源代码提交:`bd0ca9825b3206b1a53bf27bfb180a551ab39236`
-- 平台:Apple M4 Pro、macOS 15.7.2、arm64
-- JDK:`26.0.1`
-- VM:`OpenJDK 64-Bit Server VM`
-- JMH:`1.37`
-- 预热:3 次迭代,每次 `2 s`
-- 测量:5 次迭代,每次 `2 s`
-- Fork:1;线程:1
-- 模式:吞吐量;数值越高越好
-
-## String
-
-
-
-## UTF-8 字节
-
-
-
-## 结果
-
-| 表示形式 | 操作 | fory-json ops/sec | jackson ops/sec | gson ops/sec | 最快 |
-| ---------- | ---------- | ----------------: | --------------: | -----------: | --------- |
-| String | 序列化 | 7,387,465 | 2,049,368 | 1,084,042 | fory-json |
-| String | 反序列化 | 2,897,955 | 1,074,885 | 902,772 | fory-json |
-| UTF-8 字节 | 序列化 | 10,375,498 | 1,868,614 | 1,037,211 | fory-json |
-| UTF-8 字节 | 反序列化 | 3,077,158 | 1,268,397 | 933,079 | fory-json |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/json/string_throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/json/string_throughput.png
deleted file mode 100644
index 95effcaea0..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/json/string_throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/json/utf8_bytes_throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/json/utf8_bytes_throughput.png
deleted file mode 100644
index 7f2aacc375..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/json/utf8_bytes_throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/throughput.png
deleted file mode 100644
index 025f8b4329..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/javascript/throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/javascript/throughput.png
deleted file mode 100644
index 54c24051d6..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/javascript/throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/json/_category_.json b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/json/_category_.json
new file mode 100644
index 0000000000..d6cdf1f1b1
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/json/_category_.json
@@ -0,0 +1,6 @@
+{
+ "position": 4,
+ "label": "Fory JSON",
+ "collapsible": true,
+ "collapsed": true
+}
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/json/java/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/json/java/README.md
new file mode 100644
index 0000000000..e768ea48e7
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/json/java/README.md
@@ -0,0 +1,38 @@
+# Java JSON 基准测试报告
+
+本基准测试使用相同的数据比较 fory-json、Jackson 和 Gson。String 组不包含 UTF-8
+转换。UTF-8 字节组会在可用时使用直接字节数组 API。Gson 包含 String 到 UTF-8 的编码以及
+UTF-8 到 String 的解码。
+
+```bash
+cd benchmarks/java
+./run_json.sh --libs fory-json,jackson,gson
+```
+
+- 基准测试日期:`2026-07-28`
+- 源代码提交:`bd0ca9825b3206b1a53bf27bfb180a551ab39236`
+- 平台:Apple M4 Pro, macOS 15.7.2, arm64
+- JDK:`26.0.1`
+- VM:`OpenJDK 64-Bit Server VM`
+- JMH:`1.37`
+- 预热:3 次迭代 × `2 s`
+- 测量:5 次迭代 × `2 s`
+- Fork 数:1;线程数:1
+- 模式:吞吐量;数值越高越好
+
+## String
+
+
+
+## UTF-8 字节
+
+
+
+## 结果
+
+| 表示形式 | 操作 | fory-json ops/sec | jackson ops/sec | gson ops/sec | 最快 |
+| ---------- | -------- | ----------------: | --------------: | -----------: | --------- |
+| String | 序列化 | 7,387,465 | 2,049,368 | 1,084,042 | fory-json |
+| String | 反序列化 | 2,897,955 | 1,074,885 | 902,772 | fory-json |
+| UTF-8 字节 | 序列化 | 10,375,498 | 1,868,614 | 1,037,211 | fory-json |
+| UTF-8 字节 | 反序列化 | 3,077,158 | 1,268,397 | 933,079 | fory-json |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/methodology.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/methodology.md
new file mode 100644
index 0000000000..c0ce670822
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/methodology.md
@@ -0,0 +1,40 @@
+---
+title: 基准测试方法论
+sidebar_position: 2
+id: methodology
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+有价值的序列化基准测试应记录足够的上下文,以便复现工作负载,并避免将语义不同的测试当作等价结果比较。
+
+## 必需上下文
+
+- 仓库 commit 和依赖版本;
+- 硬件、操作系统、运行时版本和相关环境变量;
+- Schema 和对象填充方式;
+- xlang 或 native 模式、兼容模式、引用跟踪和注册方式;
+- 预热、fork/process、迭代次数、持续时间和并发度;
+- 测量的序列化表示和操作;
+- 精确命令和原始结果位置。
+
+## 解读报告
+
+只比较同一种操作和等价的数据语义。不要在不说明语义差异的情况下,将 xlang 载荷与 native 载荷比较,
+或将完整对象重建与 Row Format 字段访问比较。基于 JIT 和代码生成的运行时需要有代表性的预热。
+
+如果决策依赖当前代码,请运行当前有效的 benchmark harness。仓库中保存的报告只代表其记录的
+commit 和环境。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/_category_.json b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/_category_.json
similarity index 62%
copy from i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/_category_.json
copy to i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/_category_.json
index abf19e9fcb..51ce804b55 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/_category_.json
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/_category_.json
@@ -1,6 +1,6 @@
{
"position": 3,
- "label": "Schema IDL 与编译器",
+ "label": "对象序列化",
"collapsible": true,
"collapsed": true
}
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/native/_category_.json b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/native/_category_.json
new file mode 100644
index 0000000000..1baf4a4d97
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/native/_category_.json
@@ -0,0 +1,6 @@
+{
+ "position": 2,
+ "label": "Native",
+ "collapsible": true,
+ "collapsed": true
+}
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/native/java-graalvm.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/native/java-graalvm.md
new file mode 100644
index 0000000000..45c15a5a01
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/native/java-graalvm.md
@@ -0,0 +1,110 @@
+# Java GraalVM Native Image 基准测试
+
+这些测量数据涵盖 GraalVM Native Image 中的 Fory 二进制对象序列化。结果取决于记录的工作负载和环境。
+
+## 基准测试
+
+Fory 与 GraalVM JDK 序列化的性能对比:
+
+| 类型 | 压缩 | 速度提升 | 大小 |
+| ------ | ---- | -------- | ---- |
+| Struct | 关闭 | 46x | 43% |
+| Struct | 开启 | 24x | 31% |
+| Pojo | 关闭 | 12x | 56% |
+| Pojo | 开启 | 12x | 48% |
+
+基准测试代码请参阅 [Benchmark.java](https://github.com/apache/fory/blob/main/integration_tests/graalvm_tests/src/main/java/org/apache/fory/graalvm/Benchmark.java)。
+
+### Struct 基准测试
+
+#### 类字段
+
+```java
+public class Struct implements Serializable {
+ public int f1;
+ public long f2;
+ public float f3;
+ public double f4;
+ public int f5;
+ public long f6;
+ public float f7;
+ public double f8;
+ public int f9;
+ public long f10;
+ public float f11;
+ public double f12;
+}
+```
+
+#### 基准测试结果
+
+未启用压缩:
+
+```
+Benchmark repeat number: 400000
+Object type: class org.apache.fory.graalvm.Struct
+Compress number: false
+Fory size: 76.0
+JDK size: 178.0
+Fory serialization took mills: 49
+JDK serialization took mills: 2254
+Compare speed: Fory is 45.70x speed of JDK
+Compare size: Fory is 0.43x size of JDK
+```
+
+启用数字压缩:
+
+```
+Benchmark repeat number: 400000
+Object type: class org.apache.fory.graalvm.Struct
+Compress number: true
+Fory size: 55.0
+JDK size: 178.0
+Fory serialization took mills: 130
+JDK serialization took mills: 3161
+Compare speed: Fory is 24.16x speed of JDK
+Compare size: Fory is 0.31x size of JDK
+```
+
+### POJO 基准测试
+
+#### 类字段
+
+```java
+public class Foo implements Serializable {
+ int f1;
+ String f2;
+ List<String> f3;
+ Map<String, Long> f4;
+}
+```
+
+#### 基准测试结果
+
+未启用压缩:
+
+```
+Benchmark repeat number: 400000
+Object type: class org.apache.fory.graalvm.Foo
+Compress number: false
+Fory size: 541.0
+JDK size: 964.0
+Fory serialization took mills: 1663
+JDK serialization took mills: 16266
+Compare speed: Fory is 12.19x speed of JDK
+Compare size: Fory is 0.56x size of JDK
+```
+
+启用数字压缩:
+
+```
+Benchmark repeat number: 400000
+Object type: class org.apache.fory.graalvm.Foo
+Compress number: true
+Fory size: 459.0
+JDK size: 964.0
+Fory serialization took mills: 1289
+JDK serialization took mills: 15069
+Compare speed: Fory is 12.11x speed of JDK
+Compare size: Fory is 0.48x size of JDK
+```
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/native/java/README.md
similarity index 82%
rename from i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/README.md
rename to i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/native/java/README.md
index 400dad9d49..da0943b7fc 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/java/README.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/native/java/README.md
@@ -1,30 +1,30 @@
-# Java 基准测试
+# Java 原生序列化基准测试
-有关 fory-json、Jackson 和 Gson 的结果,请参阅 [Java JSON 基准报告](json/)。
+有关 fory-json、Jackson 和 Gson 的测试结果,请参阅 [Java JSON 基准测试报告](../../../json/java/README.md)。
## 系统环境
-- Operation System:4.9.151-015.x86_64
+- 操作系统:4.9.151-015.x86_64
- CPU:Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
-- Byte Order:Little Endian
-- L1d cache: 32K
-- L1i cache:32K
-- L2 cache: 1024K
-- L3 cache: 33792K
+- 字节序:小端序
+- L1d 缓存: 32K
+- L1i 缓存:32K
+- L2 缓存: 1024K
+- L3 缓存: 33792K
## JMH 参数
-不要跳过 **warm up**,否则结果不准确。
+不要跳过**预热**,否则测试结果会不准确。
```bash
-f 1 -wi 3 -i 3 -t 1 -w 2s -r 2s -rf cs
```
-## 基准数据
+## 基准测试数据
### Struct
-Struct 是一个包含 100 个基础类型字段的类:
+Struct 是一个包含 100 个基本类型字段的类:
```java
public class Struct {
@@ -54,95 +54,87 @@ public class Struct {
### MediaContent
-MEDIA_CONTENT 来自 [jvm-serializers](https://github.com/eishay/jvm-serializers/blob/master/tpc/src/data/media/MediaContent.java).
+MEDIA_CONTENT 是来自 [jvm-serializers](https://github.com/eishay/jvm-serializers/blob/master/tpc/src/data/media/MediaContent.java) 的类。
### Sample
-SAMPLE 来自 [kryo benchmark](https://github.com/EsotericSoftware/kryo/blob/master/benchmarks/src/main/java/com/esotericsoftware/kryo/benchmarks/data/Sample.java)
+SAMPLE 是来自 [Kryo 基准测试](https://github.com/EsotericSoftware/kryo/blob/master/benchmarks/src/main/java/com/esotericsoftware/kryo/benchmarks/data/Sample.java) 的类。
-## 基准图表
+## Java 基准测试
-### 序列化到堆内缓冲区
+### 序列化至堆内缓冲区
-将数据序列化到 Java 字节数组。
+将数据序列化为 Java 字节数组。
-#### Java schema 一致性序列化
+#### Java 同 Schema 序列化
-反序列化端必须与序列化端使用相同的类定义。
-该模式不支持类的前向/后向兼容。
+读取端和写入端使用相同的类 Schema。此模式不使用类的向前/向后兼容能力。
-
+
-#### Java schema 兼容模式序列化
+#### Java 兼容序列化
-反序列化端可以与序列化端使用不同的类定义。
-该模式支持类的前向/后向兼容。
+读取端和写入端可以使用不同的类 Schema。此模式支持类的向前/向后兼容。
-
+
-#### Java schema 一致性反序列化
+#### Java 同 Schema 反序列化
-反序列化端必须与序列化端使用相同的类定义。
-该模式不支持类的前向/后向兼容。
+读取端和写入端使用相同的类 Schema。此模式不使用类的向前/向后兼容能力。
-
+
-#### Java schema 兼容模式反序列化
+#### Java 兼容反序列化
-反序列化端可以与序列化端使用不同的类定义。
-该模式支持类的前向/后向兼容。
+读取端和写入端可以使用不同的类 Schema。此模式支持类的向前/向后兼容。
-
+
### 堆外序列化
-将数据序列化到堆外内存。
+在堆外内存中序列化数据。
-#### Java schema 一致性序列化
+#### Java 同 Schema 序列化
-反序列化端必须与序列化端使用相同的类定义。
-该模式不支持类的前向/后向兼容。
+读取端和写入端使用相同的类 Schema。此模式不使用类的向前/向后兼容能力。
-
+
-#### Java schema 兼容模式序列化
+#### Java 兼容序列化
-反序列化端可以与序列化端使用不同的类定义。
-该模式支持类的前向/后向兼容。
+读取端和写入端可以使用不同的类 Schema。此模式支持类的向前/向后兼容。
-
+
-#### Java schema 一致性反序列化
+#### Java 同 Schema 反序列化
-反序列化端必须与序列化端使用相同的类定义。
-该模式不支持类的前向/后向兼容。
+读取端和写入端使用相同的类 Schema。此模式不使用类的向前/向后兼容能力。
-
+
-#### Java schema 兼容模式反序列化
+#### Java 兼容反序列化
-反序列化端可以与序列化端使用不同的类定义。
-该模式支持类的前向/后向兼容。
+读取端和写入端可以使用不同的类 Schema。此模式支持类的向前/向后兼容。
-
+
### 零拷贝序列化
-注意:零拷贝序列化只是在序列化阶段避免拷贝;如果将数据发送到其他机器,仍可能发生拷贝。
+请注意,零拷贝序列化只避免序列化过程中的数据复制;如果将数据发送到其他机器,仍然可能发生复制。
-但如果在同一节点进程间序列化并使用共享内存,且数据在序列化前已位于堆外,那么其他进程可无拷贝读取该缓冲区。
+但是,如果在同一节点的进程之间通过共享内存序列化数据,并且数据在序列化前已位于堆外内存中,那么其他进程无需任何复制即可读取此缓冲区。
-#### Java 零拷贝序列化到堆内缓冲区
+#### Java 零拷贝序列化至堆内缓冲区
-
+
-#### Java 零拷贝序列化到直接缓冲区
+#### Java 零拷贝序列化至直接缓冲区
-
+
-## 基准数据
+### 基准测试数据
-### Java Serialization
+#### Java 序列化
| Benchmark | objectType | bufferType | references | Fory | ForyMetaShared | Kryo | Fst | Hession | Jdk | Protostuff |
| ---------------------- | ------------- | ------------ | ---------- | -------------- | --------------- | -------------- | ------------- | ------------- | ------------- | ------------- |
@@ -211,10 +203,10 @@ SAMPLE 来自 [kryo benchmark](https://github.com/EsotericSoftware/kryo/blob/mas
| deserialize_compatible | SAMPLE | directBuffer | False | 2308111.633661 | 2289261.533644 | 201993.787890 | | 124044.417439 | | |
| deserialize_compatible | SAMPLE | directBuffer | True | 1820490.585648 | 1927548.827586 | 174534.710870 | | 120276.449497 | | |
-### Java 零拷贝
+#### Java 零拷贝
| Benchmark | array_size | bufferType | dataType | Fory | Kryo | Fst |
-| ---- | ---------- | ------------ | --------------- | -------------- | -------------- | -------------- |
+| ----------- | ---------- | ------------ | --------------- | -------------- | -------------- | -------------- |
| serialize | 200 | array | BUFFER | 5123572.914045 | 1985187.977633 | 2400193.220466 |
| serialize | 200 | array | PRIMITIVE_ARRAY | 8297232.942927 | 147342.606262 | 313986.053417 |
| serialize | 200 | directBuffer | BUFFER | 5400346.890126 | 1739454.519770 | 2282550.111756 |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/_category_.json b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/_category_.json
new file mode 100644
index 0000000000..d2418b5e5e
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/_category_.json
@@ -0,0 +1,6 @@
+{
+ "position": 1,
+ "label": "Xlang",
+ "collapsible": true,
+ "collapsed": true
+}
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/cpp/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/cpp/README.md
new file mode 100644
index 0000000000..36291851d6
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/cpp/README.md
@@ -0,0 +1,78 @@
+# C++ 基准测试性能报告
+
+_生成时间:2026-06-12 16:14:04_
+
+## 如何生成此报告
+
+```bash
+cd benchmarks/cpp/build
+./fory_benchmark --benchmark_format=json --benchmark_out=benchmark_results.json
+cd ..
+python benchmark_report.py --json-file build/benchmark_results.json --output-dir report
+```
+
+## 基准测试图表
+
+下图展示吞吐量(ops/sec);数值越高越好。
+
+
+
+## 硬件和操作系统信息
+
+| 项目 | 值 |
+| ---------------------- | ------------------------- |
+| 操作系统 | Darwin 24.6.0 |
+| 机器架构 | arm64 |
+| 处理器 | arm |
+| CPU 核心数(物理) | 12 |
+| CPU 核心数(逻辑) | 12 |
+| 内存总量(GB) | 48.0 |
+| 基准测试日期 | 2026-06-12T16:13:27+08:00 |
+| CPU 核心数(基准测试) | 12 |
+
+## 基准测试结果
+
+### 耗时结果(nanoseconds)
+
+| 数据类型 | 操作 | fory (ns) | protobuf (ns) | msgpack (ns) | 最快 |
+| ----------------- | -------- | --------- | ------------- | ------------ | ---- |
+| NumericStruct | 序列化 | 25.7 | 48.2 | 85.4 | fory |
+| NumericStruct | 反序列化 | 25.1 | 31.8 | 887.2 | fory |
+| Sample | 序列化 | 60.6 | 96.4 | 361.6 | fory |
+| Sample | 反序列化 | 176.7 | 397.0 | 2031.6 | fory |
+| MediaContent | 序列化 | 113.5 | 471.0 | 290.4 | fory |
+| MediaContent | 反序列化 | 247.3 | 641.9 | 2015.4 | fory |
+| NumericStructList | 序列化 | 83.3 | 372.9 | 446.9 | fory |
+| NumericStructList | 反序列化 | 158.1 | 268.2 | 4342.4 | fory |
+| SampleList | 序列化 | 258.8 | 2829.7 | 2602.3 | fory |
+| SampleList | 反序列化 | 1001.7 | 2794.4 | 12220.7 | fory |
+| MediaContentList | 序列化 | 504.2 | 2589.8 | 1549.5 | fory |
+| MediaContentList | 反序列化 | 1258.6 | 3620.3 | 10263.4 | fory |
+
+### 吞吐量结果(ops/sec)
+
+| 数据类型 | 操作 | fory TPS | protobuf TPS | msgpack TPS | 最快 |
+| ----------------- | -------- | ---------- | ------------ | ----------- | ---- |
+| NumericStruct | 序列化 | 38,845,461 | 20,734,963 | 11,707,994 | fory |
+| NumericStruct | 反序列化 | 39,872,217 | 31,443,829 | 1,127,092 | fory |
+| Sample | 序列化 | 16,496,488 | 10,372,657 | 2,765,312 | fory |
+| Sample | 反序列化 | 5,660,852 | 2,518,926 | 492,232 | fory |
+| MediaContent | 序列化 | 8,808,084 | 2,122,926 | 3,443,519 | fory |
+| MediaContent | 反序列化 | 4,043,028 | 1,557,819 | 496,175 | fory |
+| NumericStructList | 序列化 | 11,999,598 | 2,681,661 | 2,237,536 | fory |
+| NumericStructList | 反序列化 | 6,323,730 | 3,728,133 | 230,285 | fory |
+| SampleList | 序列化 | 3,864,068 | 353,391 | 384,276 | fory |
+| SampleList | 反序列化 | 998,326 | 357,854 | 81,828 | fory |
+| MediaContentList | 序列化 | 1,983,502 | 386,135 | 645,372 | fory |
+| MediaContentList | 反序列化 | 794,544 | 276,221 | 97,434 | fory |
+
+### 序列化数据大小(bytes)
+
+| 数据类型 | fory | protobuf | msgpack |
+| ----------------- | ---- | -------- | ------- |
+| NumericStruct | 78 | 93 | 87 |
+| Sample | 445 | 375 | 530 |
+| MediaContent | 362 | 301 | 480 |
+| NumericStructList | 255 | 475 | 449 |
+| SampleList | 1978 | 1890 | 2664 |
+| MediaContentList | 1531 | 1520 | 2421 |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/csharp/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/csharp/README.md
new file mode 100644
index 0000000000..898f69defb
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/csharp/README.md
@@ -0,0 +1,89 @@
+# C# 基准测试性能报告
+
+_生成于 2026-05-08 17:54:45_
+
+## 如何生成本报告
+
+```bash
+cd benchmarks/csharp
+dotnet run -c Release --project ./Fory.CSharpBenchmark.csproj -- --output build/benchmark_results.json
+python3 benchmark_report.py --json-file build/benchmark_results.json --output-dir report
+```
+
+## 基准测试图表
+
+该图展示吞吐量(ops/sec);数值越高越好。
+
+
+
+## 硬件和操作系统信息
+
+| 键 | 值 |
+| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
+| 操作系统 | Darwin 24.6.0 Darwin Kernel Version 24.6.0: Wed Oct 15 21:12:15 PDT 2025; root:xnu-11417.140.69.703.14~1/RELEASE_ARM64_T6041 |
+| 操作系统架构 | Arm64 |
+| 机器架构 | Arm64 |
+| 运行时版本 | 8.0.24 |
+| 基准测试日期(UTC) | 2026-05-08T08:17:48.7871870Z |
+| 预热时间(秒) | 1 |
+| 运行时间(秒) | 3 |
+| CPU 逻辑核心数(来自基准测试) | 12 |
+| CPU 核心数(物理) | 12 |
+| CPU 核心数(逻辑) | 12 |
+| 内存总量(GB) | 48.0 |
+
+## 基准测试覆盖范围
+
+| 键 | 值 |
+| -------------------- | ---------------------------------------------------------------------- |
+| 输入 JSON 中的用例数 | 36 / 36 |
+| 序列化器 | fory, msgpack, protobuf |
+| 数据类型 | struct, sample, mediacontent, structlist, samplelist, mediacontentlist |
+| 操作 | serialize, deserialize |
+
+## 基准测试结果
+
+### 耗时结果(纳秒)
+
+| 数据类型 | 操作 | fory(ns) | protobuf(ns) | msgpack(ns) | 最快 |
+| ----------------- | -------- | ---------- | -------------- | ------------- | ---- |
+| NumericStruct | 序列化 | 50.3 | 170.8 | 107.8 | fory |
+| NumericStruct | 反序列化 | 82.4 | 252.0 | 143.4 | fory |
+| Sample | 序列化 | 263.2 | 607.1 | 377.1 | fory |
+| Sample | 反序列化 | 199.4 | 1191.7 | 785.6 | fory |
+| MediaContent | 序列化 | 379.7 | 509.6 | 417.6 | fory |
+| MediaContent | 反序列化 | 450.3 | 846.6 | 791.4 | fory |
+| NumericStructList | 序列化 | 183.7 | 641.8 | 447.8 | fory |
+| NumericStructList | 反序列化 | 288.3 | 974.3 | 702.1 | fory |
+| SampleList | 序列化 | 1205.7 | 3559.1 | 1864.1 | fory |
+| SampleList | 反序列化 | 895.1 | 5710.3 | 2757.4 | fory |
+| MediaContentList | 序列化 | 1495.4 | 2473.6 | 1812.4 | fory |
+| MediaContentList | 反序列化 | 1946.7 | 3789.3 | 3778.4 | fory |
+
+### 吞吐量结果(ops/sec)
+
+| 数据类型 | 操作 | fory TPS | protobuf TPS | msgpack TPS | 最快 |
+| ----------------- | -------- | ---------- | ------------ | ----------- | ---- |
+| NumericStruct | 序列化 | 19,881,457 | 5,853,473 | 9,276,378 | fory |
+| NumericStruct | 反序列化 | 12,137,374 | 3,968,585 | 6,973,504 | fory |
+| Sample | 序列化 | 3,799,418 | 1,647,119 | 2,652,142 | fory |
+| Sample | 反序列化 | 5,016,006 | 839,129 | 1,272,975 | fory |
+| MediaContent | 序列化 | 2,633,704 | 1,962,428 | 2,394,549 | fory |
+| MediaContent | 反序列化 | 2,220,537 | 1,181,222 | 1,263,568 | fory |
+| NumericStructList | 序列化 | 5,445,002 | 1,558,156 | 2,232,996 | fory |
+| NumericStructList | 反序列化 | 3,469,207 | 1,026,402 | 1,424,322 | fory |
+| SampleList | 序列化 | 829,415 | 280,973 | 536,448 | fory |
+| SampleList | 反序列化 | 1,117,133 | 175,122 | 362,663 | fory |
+| MediaContentList | 序列化 | 668,732 | 404,272 | 551,755 | fory |
+| MediaContentList | 反序列化 | 513,699 | 263,899 | 264,664 | fory |
+
+### 序列化数据大小(字节)
+
+| 数据类型 | fory | protobuf | msgpack |
+| ----------------- | ---- | -------- | ------- |
+| NumericStruct | 78 | 93 | 87 |
+| Sample | 445 | 460 | 562 |
+| MediaContent | 362 | 307 | 479 |
+| NumericStructList | 255 | 475 | 444 |
+| SampleList | 1978 | 2315 | 2819 |
+| MediaContentList | 1531 | 1550 | 2404 |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/dart/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/dart/README.md
similarity index 50%
rename from i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/dart/README.md
rename to i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/dart/README.md
index b99b93440c..da607168fe 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/dart/README.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/dart/README.md
@@ -1,29 +1,29 @@
-# Fory Dart 基准
+# Fory Dart 基准测试
-该基准比较 Apache Fory、Protocol Buffers 和 JSON 在 Dart 中的序列化与反序列化吞吐量。
+本基准测试对比 Apache Fory、Protocol Buffers 和 JSON 在 Dart 中的序列化与反序列化吞吐量。
-## 吞吐图表
+## 吞吐量图表
-
+
-## 硬件与运行时信息
+## 硬件和运行时信息
-| 键 | 值 |
-| --------------------- | ----------------------------------------------------------------- |
-| 时间戳 | 2026-05-08T08:23:10.201764Z |
-| 操作系统 | Version 15.7.2 (Build 24G325) |
-| 主机 | MacBook-Pro.local |
-| CPU 核心数(逻辑) | 12 |
-| 内存(GB) | 48.00 |
-| Dart | 3.10.7 (stable) (Tue Dec 23 00:01:57 2025 -0800) on "macos_arm64" |
-| 每个用例采样次数 | 5 |
-| 每个用例预热时长(秒) | 1.0 |
-| 每个用例持续时长(秒) | 1.5 |
+| 键 | 值 |
+| ------------------------ | ----------------------------------------------------------------- |
+| 时间戳 | 2026-05-08T08:23:10.201764Z |
+| 操作系统 | Version 15.7.2 (Build 24G325) |
+| 主机 | MacBook-Pro.local |
+| CPU 核心数(逻辑) | 12 |
+| 内存(GB) | 48.00 |
+| Dart | 3.10.7 (stable) (Tue Dec 23 00:01:57 2025 -0800) on "macos_arm64" |
+| 每个用例的样本数 | 5 |
+| 每个用例的预热时间(秒) | 1.0 |
+| 每个用例的运行时间(秒) | 1.5 |
-## 吞吐结果
+## 吞吐量结果
-| 数据类型 | 操作 | Fory TPS | Protobuf TPS | JSON TPS | 最快 |
-| ----------------- | ---- | --------: | -----------: | --------: | ------------- |
+| 数据类型 | 操作 | Fory TPS | Protobuf TPS | JSON TPS | 最快 |
+| ----------------- | -------- | --------: | -----------: | --------: | ------------- |
| NumericStruct | 序列化 | 9,007,809 | 1,582,003 | 774,574 | fory (5.69x) |
| NumericStruct | 反序列化 | 9,039,403 | 3,343,459 | 1,391,036 | fory (2.70x) |
| Sample | 序列化 | 2,434,800 | 538,385 | 133,800 | fory (4.52x) |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/go/README.md
similarity index 61%
rename from i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/README.md
rename to i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/go/README.md
index 265c3d42d4..1d00b31563 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/go/README.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/go/README.md
@@ -1,38 +1,38 @@
-# Go 序列化基准报告
+# Go 序列化基准测试报告
-生成时间: 2026-05-08 17:55:12
+生成时间:2026-05-08 17:55:12
## 性能图表
-
+
## 系统信息
-- **操作系统**: Darwin 24.6.0
-- **架构**: arm64
-- **Python**: 3.10.8
-
-## 性能汇总
-
-| 数据类型 | 操作 | Fory (ops/s) | Protobuf (ops/s) | Msgpack (ops/s) | Fory vs PB | Fory vs MP |
-| ----------------- | ---- | ------------ | ---------------- | --------------- | ---------- | ---------- |
-| NumericStruct | 序列化 | 12.74M | 7.16M | 3.63M | 1.78x | 3.51x |
-| NumericStruct | 反序列化 | 10.63M | 8.40M | 1.78M | 1.27x | 5.98x |
-| Sample | 序列化 | 7.16M | 2.53M | 646K | 2.84x | 11.10x |
-| Sample | 反序列化 | 3.27M | 2.10M | 343K | 1.56x | 9.54x |
-| MediaContent | 序列化 | 3.74M | 1.75M | 1.14M | 2.14x | 3.27x |
-| MediaContent | 反序列化 | 2.03M | 1.23M | 646K | 1.66x | 3.15x |
-| NumericStructList | 序列化 | 1.10M | 386K | 201K | 2.84x | 5.44x |
-| NumericStructList | 反序列化 | 1.09M | 368K | 103K | 2.96x | 10.54x |
-| SampleList | 序列化 | 496K | 126K | 36K | 3.93x | 13.83x |
-| SampleList | 反序列化 | 195K | 96K | 17K | 2.04x | 11.73x |
-| MediaContentList | 序列化 | 250K | 91K | 57K | 2.73x | 4.38x |
-| MediaContentList | 反序列化 | 112K | 74K | 31K | 1.53x | 3.65x |
+- **操作系统**:Darwin 24.6.0
+- **架构**:arm64
+- **Python**:3.10.8
+
+## 性能摘要
+
+| 数据类型 | 操作 | Fory (ops/s) | Protobuf (ops/s) | Msgpack (ops/s) | Fory 对比 PB | Fory 对比 MP |
+| ----------------- | -------- | ------------ | ---------------- | --------------- | ------------ | ------------ |
+| NumericStruct | 序列化 | 12.74M | 7.16M | 3.63M | 1.78x | 3.51x |
+| NumericStruct | 反序列化 | 10.63M | 8.40M | 1.78M | 1.27x | 5.98x |
+| Sample | 序列化 | 7.16M | 2.53M | 646K | 2.84x | 11.10x |
+| Sample | 反序列化 | 3.27M | 2.10M | 343K | 1.56x | 9.54x |
+| MediaContent | 序列化 | 3.74M | 1.75M | 1.14M | 2.14x | 3.27x |
+| MediaContent | 反序列化 | 2.03M | 1.23M | 646K | 1.66x | 3.15x |
+| NumericStructList | 序列化 | 1.10M | 386K | 201K | 2.84x | 5.44x |
+| NumericStructList | 反序列化 | 1.09M | 368K | 103K | 2.96x | 10.54x |
+| SampleList | 序列化 | 496K | 126K | 36K | 3.93x | 13.83x |
+| SampleList | 反序列化 | 195K | 96K | 17K | 2.04x | 11.73x |
+| MediaContentList | 序列化 | 250K | 91K | 57K | 2.73x | 4.38x |
+| MediaContentList | 反序列化 | 112K | 74K | 31K | 1.53x | 3.65x |
## 详细耗时(ns/op)
-| 数据类型 | 操作 | Fory | Protobuf | Msgpack |
-| ----------------- | ---- | ------ | -------- | ------- |
+| 数据类型 | 操作 | Fory | Protobuf | Msgpack |
+| ----------------- | -------- | ------ | -------- | ------- |
| NumericStruct | 序列化 | 78.5 | 139.6 | 275.5 |
| NumericStruct | 反序列化 | 94.0 | 119.0 | 562.5 |
| Sample | 序列化 | 139.6 | 395.9 | 1549.0 |
@@ -48,7 +48,7 @@
### 序列化数据大小(字节)
-| 数据类型 | Fory | Protobuf | Msgpack |
+| 数据类型 | Fory | Protobuf | Msgpack |
| ----------------- | ---- | -------- | ------- |
| NumericStruct | 78 | 93 | 88 |
| Sample | 445 | 375 | 524 |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/java/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/java/README.md
new file mode 100644
index 0000000000..faed899e00
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/java/README.md
@@ -0,0 +1,44 @@
+# Java Xlang 序列化基准测试
+
+有关 fory-json、Jackson 和 Gson 的结果,请参阅 [Java JSON 基准测试报告](../../../json/java/README.md)。
+
+本报告涵盖由 `benchmarks/java/run.sh` 生成的 xlang 基准测试组。它不沿用单独的 [Java 原生模式报告](../../native/java/README.md) 中记录的环境或原生模式工作负载。仓库中检入的 xlang 快照没有记录主机、Fory 提交或依赖版本;在使用这些结果进行当前对比之前,请重新运行基准测试。
+
+新建或更新报告时所需的元数据,请参阅[基准测试方法](../../../methodology.md)。
+
+## 工作负载
+
+- `NumericStruct`:包含基本类型数值字段。
+- `Sample`:[Kryo 基准测试套件](https://github.com/EsotericSoftware/kryo/blob/master/benchmarks/src/main/java/com/esotericsoftware/kryo/benchmarks/data/Sample.java)使用的模型。
+- `MediaContent`:[jvm-serializers](https://github.com/eishay/jvm-serializers/blob/master/tpc/src/data/media/MediaContent.java) 中的媒体模型。
+- `*List`:对应模型的列表。
+
+## 运行基准测试
+
+从 `benchmarks/java/run.sh` 运行。原始 JMH JSON 保留在已忽略的本地 `benchmarks/java/reports/` 目录中;`throughput.png` 和这份 xlang 报告发布在 `docs/benchmarks/object-serialization/xlang/java/` 下。
+
+```bash
+cd benchmarks/java
+./run.sh
+```
+
+JMH 参数:`-f 1 -wi 3 -i 3 -t 1 -w 3s -r 3s -bm thrpt -tu s`。不要跳过预热。吞吐量越高越好。
+
+## 结果
+
+
+
+| 数据类型 | 操作 | Fory ops/sec | Protobuf ops/sec | Flatbuffer ops/sec | 最快 |
+| ----------------- | -------- | ------------ | ---------------- | ------------------ | ---- |
+| NumericStruct | 序列化 | 46,787,647 | 33,024,161 | 9,612,018 | Fory |
+| NumericStruct | 反序列化 | 71,683,707 | 29,837,931 | 40,514,436 | Fory |
+| Sample | 序列化 | 17,406,902 | 2,071,963 | 3,153,672 | Fory |
+| Sample | 反序列化 | 17,772,123 | 1,867,967 | 4,179,494 | Fory |
+| MediaContent | 序列化 | 10,783,325 | 1,781,338 | 1,444,737 | Fory |
+| MediaContent | 反序列化 | 7,950,203 | 2,184,597 | 3,453,985 | Fory |
+| NumericStructList | 序列化 | 21,263,673 | 2,511,081 | 3,047,836 | Fory |
+| NumericStructList | 反序列化 | 19,249,877 | 2,067,204 | 8,168,569 | Fory |
+| SampleList | 序列化 | 4,580,165 | 401,280 | 696,268 | Fory |
+| SampleList | 反序列化 | 3,811,985 | 344,945 | 773,625 | Fory |
+| MediaContentList | 序列化 | 1,657,717 | 353,717 | 296,868 | Fory |
+| MediaContentList | 反序列化 | 1,111,043 | 435,956 | 516,192 | Fory |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/javascript/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/javascript/README.md
similarity index 65%
rename from i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/javascript/README.md
rename to i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/javascript/README.md
index 574bb7dfe2..c32ddd8479 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/javascript/README.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/javascript/README.md
@@ -1,45 +1,45 @@
-# JavaScript 基准性能报告
+# JavaScript 基准测试性能报告
_生成于 2026-05-08 17:55:12_
-## 如何生成本报告
+## 如何生成此报告
```bash
cd benchmarks/javascript
./run.sh
```
-## 基准语义
+## 基准测试语义
-计时的序列化器循环使用各序列化器原生的类型化值。Fory 接收其 schema 使用的预归一化 Fory 值,protobuf 接收预构造的 protobuf 形态值,JSON 接收基准 JavaScript 对象。Protobuf 耗时不包含 `toProto`、`fromProto`、`protobufjs.create` 或 `toObject` 转换工作。
+计时的序列化器循环使用各序列化器原生的类型化值。Fory 接收其模式所使用的预规范化 Fory 值,protobuf 接收预先构建的 protobuf 形态值,JSON 接收基准测试所用的 JavaScript 对象。protobuf 的计时不包括 `toProto`、`fromProto`、`protobufjs.create` 或 `toObject` 的转换开销。
-## 基准图表
+## 基准测试图
-图表展示吞吐量(ops/sec);数值越高越好。
+图中展示吞吐量(ops/sec);数值越高越好。
-
+
-## 硬件与操作系统信息
+## 硬件和操作系统信息
-| 键 | 值 |
+| 项目 | 值 |
| -------------------------- | ------------------------ |
-| 操作系统 | Darwin 24.6.0 |
-| 机器架构 | arm64 |
-| 处理器 | arm |
-| CPU 核心数(物理) | 12 |
-| CPU 核心数(逻辑) | 12 |
-| 总内存(GB) | 48.0 |
-| 基准日期 | 2026-05-08T08:07:36.073Z |
-| CPU 核心数(基准采集) | 12 |
+| 操作系统 | Darwin 24.6.0 |
+| 机器架构 | arm64 |
+| 处理器 | arm |
+| CPU 核心数(物理) | 12 |
+| CPU 核心数(逻辑) | 12 |
+| 内存总量(GB) | 48.0 |
+| 基准测试日期 | 2026-05-08T08:07:36.073Z |
+| CPU 核心数(来自基准测试) | 12 |
| Node.js | v22.20.0 |
| V8 | 12.4.254.21-node.33 |
-## 基准结果
+## 基准测试结果
-### 延迟结果(纳秒)
+### 耗时结果(纳秒)
-| 数据类型 | 操作 | fory (ns) | protobuf (ns) | json (ns) | 最快 |
-| ----------------- | ---- | --------- | ------------- | --------- | -------- |
+| 数据类型 | 操作 | fory (ns) | protobuf (ns) | json (ns) | 最快 |
+| ----------------- | -------- | --------- | ------------- | --------- | -------- |
| NumericStruct | 序列化 | 76.0 | 613.0 | 496.0 | fory |
| NumericStruct | 反序列化 | 56.9 | 94.8 | 333.0 | fory |
| Sample | 序列化 | 318.0 | 2016.6 | 1409.3 | fory |
@@ -53,10 +53,10 @@ cd benchmarks/javascript
| MediaContentList | 序列化 | 2785.9 | 7616.6 | 3611.5 | fory |
| MediaContentList | 反序列化 | 3709.7 | 3018.6 | 5294.5 | protobuf |
-### 吞吐结果(ops/sec)
+### 吞吐量结果(ops/sec)
-| 数据类型 | 操作 | fory TPS | protobuf TPS | json TPS | 最快 |
-| ----------------- | ---- | ---------- | ------------ | --------- | -------- |
+| 数据类型 | 操作 | fory TPS | protobuf TPS | json TPS | 最快 |
+| ----------------- | -------- | ---------- | ------------ | --------- | -------- |
| NumericStruct | 序列化 | 13,162,466 | 1,631,271 | 2,016,097 | fory |
| NumericStruct | 反序列化 | 17,568,418 | 10,543,763 | 3,002,971 | fory |
| Sample | 序列化 | 3,144,194 | 495,893 | 709,593 | fory |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/python/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/python/README.md
similarity index 52%
rename from i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/python/README.md
rename to i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/python/README.md
index fa2de3f06f..db46fc47ee 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/python/README.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/python/README.md
@@ -1,4 +1,4 @@
-# Python 基准性能报告
+# Python 基准测试性能报告
_生成于 2026-05-08 17:54:45_
@@ -9,73 +9,73 @@ cd benchmarks/python
./run.sh
```
-## 基准图表
+## 基准测试图表
-图表展示吞吐量(ops/sec);数值越高越好。
+图表显示吞吐量(ops/sec);越高越好。
-
+
-## 硬件与操作系统信息
+## 硬件和操作系统信息
-| 键 | 值 |
-| --------------------- | ---------------------------- |
-| 操作系统 | Darwin 24.6.0 |
-| 机器架构 | arm64 |
+| 键 | 值 |
+| ------------------ | ---------------------------- |
+| 操作系统 | Darwin 24.6.0 |
+| 机器架构 | arm64 |
| 处理器 | arm |
-| Python | 3.10.8 |
-| CPU 核心数(物理) | 12 |
-| CPU 核心数(逻辑) | 12 |
-| 总内存(GB) | 48.0 |
-| Python 实现 | CPython |
-| 基准平台 | macOS-15.7.2-arm64-arm-64bit |
-
-## 基准配置
-
-| 键 | 值 |
-| ---------- | ----- |
-| warmup | 3 |
-| iterations | 15 |
-| repeat | 5 |
-| number | 1000 |
-| list_size | 5 |
-
-## 基准结果
-
-### 延迟结果(纳秒)
-
-| 数据类型 | 操作 | fory (ns) | protobuf (ns) | pickle (ns) | 最快 |
-| ----------------- | ---- | --------- | ------------- | ---- | ------- |
-| NumericStruct | 序列化 | 491.4 | 802.3 | 1119.8 | fory |
-| NumericStruct | 反序列化 | 522.2 | 1211.6 | 1788.7 | fory |
-| Sample | 序列化 | 1096.4 | 3315.8 | 10185.2 | fory |
-| Sample | 反序列化 | 2772.0 | 6659.7 | 7061.9 | fory |
-| MediaContent | 序列化 | 989.2 | 3433.2 | 4392.7 | fory |
-| MediaContent | 反序列化 | 1518.7 | 4381.2 | 4305.1 | fory |
-| NumericStructList | 序列化 | 1111.2 | 4707.9 | 3235.8 | fory |
-| NumericStructList | 反序列化 | 1891.7 | 6891.0 | 3974.9 | fory |
-| SampleList | 序列化 | 3447.2 | 18719.1 | 32125.7 | fory |
-| SampleList | 反序列化 | 13131.6 | 35264.2 | 24154.4 | fory |
-| MediaContentList | 序列化 | 2996.5 | 17597.4 | 11087.8 | fory |
-| MediaContentList | 反序列化 | 6228.7 | 21562.0 | 10459.3 | fory |
-
-### 吞吐结果(ops/sec)
-
-| 数据类型 | 操作 | fory TPS | protobuf TPS | pickle TPS | 最快 |
-| ----------------- | ---- | --------- | ------------ | ---------- | ------- |
-| NumericStruct | 序列化 | 2,035,025 | 1,246,379 | 893,009 | fory |
-| NumericStruct | 反序列化 | 1,915,112 | 825,344 | 559,055 | fory |
-| Sample | 序列化 | 912,072 | 301,590 | 98,182 | fory |
-| Sample | 反序列化 | 360,751 | 150,158 | 141,605 | fory |
-| MediaContent | 序列化 | 1,010,939 | 291,275 | 227,652 | fory |
-| MediaContent | 反序列化 | 658,462 | 228,247 | 232,281 | fory |
-| NumericStructList | 序列化 | 899,960 | 212,407 | 309,040 | fory |
-| NumericStructList | 反序列化 | 528,636 | 145,116 | 251,580 | fory |
-| SampleList | 序列化 | 290,092 | 53,421 | 31,128 | fory |
-| SampleList | 反序列化 | 76,152 | 28,357 | 41,400 | fory |
-| MediaContentList | 序列化 | 333,720 | 56,826 | 90,189 | fory |
-| MediaContentList | 反序列化 | 160,547 | 46,378 | 95,609 | fory |
-
-### 序列化数据大小(字节)
+| Python | 3.10.8 |
+| CPU 核心数(物理) | 12 |
+| CPU 核心数(逻辑) | 12 |
+| 内存总量(GB) | 48.0 |
+| Python 实现 | CPython |
+| 基准测试平台 | macOS-15.7.2-arm64-arm-64bit |
+
+## 基准测试配置
+
+| 键 | 值 |
+| ---------- | ---- |
+| warmup | 3 |
+| iterations | 15 |
+| repeat | 5 |
+| number | 1000 |
+| list_size | 5 |
+
+## 基准测试结果
+
+### 耗时结果(nanoseconds)
+
+| 数据类型 | 操作 | fory (ns) | protobuf (ns) | pickle (ns) | 最快 |
+| ----------------- | -------- | --------- | ------------- | ----------- | ---- |
+| NumericStruct | 序列化 | 491.4 | 802.3 | 1119.8 | fory |
+| NumericStruct | 反序列化 | 522.2 | 1211.6 | 1788.7 | fory |
+| Sample | 序列化 | 1096.4 | 3315.8 | 10185.2 | fory |
+| Sample | 反序列化 | 2772.0 | 6659.7 | 7061.9 | fory |
+| MediaContent | 序列化 | 989.2 | 3433.2 | 4392.7 | fory |
+| MediaContent | 反序列化 | 1518.7 | 4381.2 | 4305.1 | fory |
+| NumericStructList | 序列化 | 1111.2 | 4707.9 | 3235.8 | fory |
+| NumericStructList | 反序列化 | 1891.7 | 6891.0 | 3974.9 | fory |
+| SampleList | 序列化 | 3447.2 | 18719.1 | 32125.7 | fory |
+| SampleList | 反序列化 | 13131.6 | 35264.2 | 24154.4 | fory |
+| MediaContentList | 序列化 | 2996.5 | 17597.4 | 11087.8 | fory |
+| MediaContentList | 反序列化 | 6228.7 | 21562.0 | 10459.3 | fory |
+
+### 吞吐量结果(ops/sec)
+
+| 数据类型 | 操作 | fory TPS | protobuf TPS | pickle TPS | 最快 |
+| ----------------- | -------- | --------- | ------------ | ---------- | ---- |
+| NumericStruct | 序列化 | 2,035,025 | 1,246,379 | 893,009 | fory |
+| NumericStruct | 反序列化 | 1,915,112 | 825,344 | 559,055 | fory |
+| Sample | 序列化 | 912,072 | 301,590 | 98,182 | fory |
+| Sample | 反序列化 | 360,751 | 150,158 | 141,605 | fory |
+| MediaContent | 序列化 | 1,010,939 | 291,275 | 227,652 | fory |
+| MediaContent | 反序列化 | 658,462 | 228,247 | 232,281 | fory |
+| NumericStructList | 序列化 | 899,960 | 212,407 | 309,040 | fory |
+| NumericStructList | 反序列化 | 528,636 | 145,116 | 251,580 | fory |
+| SampleList | 序列化 | 290,092 | 53,421 | 31,128 | fory |
+| SampleList | 反序列化 | 76,152 | 28,357 | 41,400 | fory |
+| MediaContentList | 序列化 | 333,720 | 56,826 | 90,189 | fory |
+| MediaContentList | 反序列化 | 160,547 | 46,378 | 95,609 | fory |
+
+### 序列化数据大小(bytes)
| 数据类型 | fory | protobuf | pickle |
| ----------------- | ---- | -------- | ------ |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/rust/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/rust/README.md
similarity index 60%
rename from i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/rust/README.md
rename to i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/rust/README.md
index fd76da8ff1..c5d2021d0f 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/rust/README.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/rust/README.md
@@ -1,8 +1,8 @@
-# Rust 基准性能报告
+# Rust 基准测试性能报告
-_生成于 2026-05-08 17:55:12_
+_生成时间:2026-05-08 17:55:12_
-## 如何生成本报告
+## 如何生成此报告
```bash
cd benchmarks/rust
@@ -12,61 +12,61 @@ cargo run --release --manifest-path xlang/Cargo.toml --bin fory_profiler -- --pr
python benchmark_report.py --log-file results/cargo_bench.log --size-file results/serialized_sizes.txt --output-dir results
```
-## 基准图表
+## 基准测试图表
-图表展示吞吐量(ops/sec);数值越高越好。
+下图展示吞吐量(ops/sec);数值越高越好。
-
+
-## 硬件与操作系统信息
+## 硬件和操作系统信息
-| 键 | 值 |
-| -------------------- | ------------------- |
-| 操作系统 | Darwin 24.6.0 |
-| 机器架构 | arm64 |
-| 处理器 | arm |
+| 项目 | 值 |
+| ------------------ | ------------------- |
+| 操作系统 | Darwin 24.6.0 |
+| 机器架构 | arm64 |
+| 处理器 | arm |
| CPU 核心数(物理) | 12 |
-| CPU 核心数(逻辑) | 12 |
-| 总内存(GB) | 48.0 |
-| 基准日期 | 2026-05-08T16:47:49 |
+| CPU 核心数(逻辑) | 12 |
+| 内存总量(GB) | 48.0 |
+| 基准测试日期 | 2026-05-08T16:47:49 |
-## 基准结果
+## 基准测试结果
-### 延迟结果(纳秒)
+### 耗时结果(nanoseconds)
-| 数据类型 | 操作 | fory (ns) | protobuf (ns) | msgpack (ns) | 最快 |
-| ----------------- | ---- | --------- | ------------- | ------------ | ------- |
-| NumericStruct | 序列化 | 38.1 | 94.6 | 239.5 | fory |
-| NumericStruct | 反序列化 | 32.6 | 62.4 | 107.3 | fory |
-| Sample | 序列化 | 95.3 | 591.8 | 601.1 | fory |
-| Sample | 反序列化 | 410.1 | 925.8 | 805.9 | fory |
-| MediaContent | 序列化 | 120.0 | 553.9 | 446.9 | fory |
-| MediaContent | 反序列化 | 566.7 | 713.0 | 902.6 | fory |
-| NumericStructList | 序列化 | 121.5 | 512.0 | 618.0 | fory |
-| NumericStructList | 反序列化 | 137.9 | 404.9 | 615.9 | fory |
-| SampleList | 序列化 | 267.7 | 2920.2 | 2011.1 | fory |
-| SampleList | 反序列化 | 1831.9 | 4636.4 | 4141.4 | fory |
-| MediaContentList | 序列化 | 367.1 | 2835.6 | 1441.7 | fory |
-| MediaContentList | 反序列化 | 2703.8 | 3622.3 | 4832.3 | fory |
+| 数据类型 | 操作 | fory (ns) | protobuf (ns) | msgpack (ns) | 最快 |
+| ----------------- | -------- | --------- | ------------- | ------------ | ---- |
+| NumericStruct | 序列化 | 38.1 | 94.6 | 239.5 | fory |
+| NumericStruct | 反序列化 | 32.6 | 62.4 | 107.3 | fory |
+| Sample | 序列化 | 95.3 | 591.8 | 601.1 | fory |
+| Sample | 反序列化 | 410.1 | 925.8 | 805.9 | fory |
+| MediaContent | 序列化 | 120.0 | 553.9 | 446.9 | fory |
+| MediaContent | 反序列化 | 566.7 | 713.0 | 902.6 | fory |
+| NumericStructList | 序列化 | 121.5 | 512.0 | 618.0 | fory |
+| NumericStructList | 反序列化 | 137.9 | 404.9 | 615.9 | fory |
+| SampleList | 序列化 | 267.7 | 2920.2 | 2011.1 | fory |
+| SampleList | 反序列化 | 1831.9 | 4636.4 | 4141.4 | fory |
+| MediaContentList | 序列化 | 367.1 | 2835.6 | 1441.7 | fory |
+| MediaContentList | 反序列化 | 2703.8 | 3622.3 | 4832.3 | fory |
-### 吞吐结果(ops/sec)
+### 吞吐量结果(ops/sec)
-| 数据类型 | 操作 | fory TPS | protobuf TPS | msgpack TPS | 最快 |
-| ----------------- | ---- | ---------- | ------------ | ---- | ------- |
-| NumericStruct | 序列化 | 26,237,767 | 10,572,613 | 4,174,668 | fory |
-| NumericStruct | 反序列化 | 30,720,079 | 16,035,920 | 9,322,271 | fory |
-| Sample | 序列化 | 10,494,611 | 1,689,874 | 1,663,700 | fory |
-| Sample | 反序列化 | 2,438,311 | 1,080,170 | 1,240,895 | fory |
-| MediaContent | 序列化 | 8,331,945 | 1,805,445 | 2,237,687 | fory |
-| MediaContent | 反序列化 | 1,764,633 | 1,402,426 | 1,107,960 | fory |
-| NumericStructList | 序列化 | 8,232,485 | 1,953,125 | 1,618,071 | fory |
-| NumericStructList | 反序列化 | 7,250,580 | 2,469,563 | 1,623,535 | fory |
-| SampleList | 序列化 | 3,735,664 | 342,442 | 497,240 | fory |
-| SampleList | 反序列化 | 545,881 | 215,685 | 241,464 | fory |
-| MediaContentList | 序列化 | 2,724,350 | 352,659 | 693,626 | fory |
-| MediaContentList | 反序列化 | 369,850 | 276,068 | 206,941 | fory |
+| 数据类型 | 操作 | fory TPS | protobuf TPS | msgpack TPS | 最快 |
+| ----------------- | -------- | ---------- | ------------ | ----------- | ---- |
+| NumericStruct | 序列化 | 26,237,767 | 10,572,613 | 4,174,668 | fory |
+| NumericStruct | 反序列化 | 30,720,079 | 16,035,920 | 9,322,271 | fory |
+| Sample | 序列化 | 10,494,611 | 1,689,874 | 1,663,700 | fory |
+| Sample | 反序列化 | 2,438,311 | 1,080,170 | 1,240,895 | fory |
+| MediaContent | 序列化 | 8,331,945 | 1,805,445 | 2,237,687 | fory |
+| MediaContent | 反序列化 | 1,764,633 | 1,402,426 | 1,107,960 | fory |
+| NumericStructList | 序列化 | 8,232,485 | 1,953,125 | 1,618,071 | fory |
+| NumericStructList | 反序列化 | 7,250,580 | 2,469,563 | 1,623,535 | fory |
+| SampleList | 序列化 | 3,735,664 | 342,442 | 497,240 | fory |
+| SampleList | 反序列化 | 545,881 | 215,685 | 241,464 | fory |
+| MediaContentList | 序列化 | 2,724,350 | 352,659 | 693,626 | fory |
+| MediaContentList | 反序列化 | 369,850 | 276,068 | 206,941 | fory |
-### 序列化数据大小(字节)
+### 序列化数据大小(bytes)
| 数据类型 | fory | protobuf | msgpack |
| ----------------- | ---- | -------- | ------- |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/swift/README.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/swift/README.md
similarity index 55%
rename from i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/swift/README.md
rename to i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/swift/README.md
index e85ebf69b5..64f4c57901 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/swift/README.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/object-serialization/xlang/swift/README.md
@@ -1,31 +1,31 @@
-# Fory Swift 基准
+# Fory Swift 基准测试
-该基准比较 Apache Fory、Protocol Buffers 和 JSON 在 Swift 中的序列化与反序列化吞吐量。
+本基准测试比较 Apache Fory、Protocol Buffers 和 JSON 在 Swift 中的序列化与反序列化吞吐量。
-## 基准产品
+## 基准测试产物
-常规/xlang 用例由 `swift-benchmark` 构建。外部类型和容器对比由独立的
-`swift-external-benchmark` 产品构建,因此构建常规产品时不会编译这些模型或序列化器特化实现。
+常规/xlang 测试用例由 `swift-benchmark` 构建。外部类型与载体的对比由独立的
+`swift-external-benchmark` 产物构建,因此构建常规产物时不会编译这些模型或序列化器特化实现。
-## 吞吐图表
+## 吞吐量图
-
+
-## 硬件与运行时信息
+## 硬件和运行时信息
-| 键 | 值 |
-| --------------------- | ----------------------------- |
-| 时间戳 | 2026-05-08T09:05:32Z |
-| 操作系统 | Version 15.7.2 (Build 24G325) |
-| 主机 | macbook-pro.local |
-| CPU 核心数(逻辑) | 12 |
-| 内存(GB) | 48.00 |
-| 每个用例持续时长(秒) | 3 |
+| 项目 | 值 |
+| ---------------------- | ----------------------------- |
+| 时间戳 | 2026-05-08T09:05:32Z |
+| 操作系统 | Version 15.7.2 (Build 24G325) |
+| 主机 | macbook-pro.local |
+| CPU 核心数(逻辑) | 12 |
+| 内存 (GB) | 48.00 |
+| 每个测试用例的时长 (s) | 3 |
-## 吞吐结果
+## 吞吐量结果
-| 数据类型 | 操作 | Fory TPS | Protobuf TPS | JSON TPS | 最快 |
-| ----------------- | ---- | ---------: | -----------: | -------: | ------------ |
+| 数据类型 | 操作 | Fory TPS | Protobuf TPS | JSON TPS | 最快 |
+| ----------------- | -------- | ---------: | -----------: | -------: | ------------ |
| NumericStruct | 序列化 | 9,435,623 | 6,175,939 | 408,960 | fory (1.53x) |
| NumericStruct | 反序列化 | 11,037,225 | 6,842,676 | 328,302 | fory (1.61x) |
| Sample | 序列化 | 3,596,835 | 1,257,100 | 79,781 | fory (2.86x) |
@@ -39,7 +39,7 @@
| MediaContentList | 序列化 | 348,238 | 98,007 | 18,698 | fory (3.55x) |
| MediaContentList | 反序列化 | 104,990 | 74,422 | 16,298 | fory (1.41x) |
-## 序列化大小(字节)
+## 序列化大小 (bytes)
| 数据类型 | Fory | Protobuf | JSON |
| ----------------- | ---: | -------: | ---: |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/python/throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/python/throughput.png
deleted file mode 100644
index 7bd99a82e6..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/python/throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/rust/throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/rust/throughput.png
deleted file mode 100644
index 5640e734e4..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/rust/throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/swift/throughput.png b/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/swift/throughput.png
deleted file mode 100644
index c8d7f75e35..0000000000
Binary files a/i18n/zh-CN/docusaurus-plugin-content-docs/current/benchmarks/swift/throughput.png and /dev/null differ
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/community.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/community.md
index 25b8db4021..3115215910 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/community.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/community.md
@@ -4,82 +4,81 @@ sidebar_position: 0
id: community
---
-Apache Fory™ 是一个由社区驱动的开源项目,项目的蓬勃发展得益于社区贡献。
-我们邀请您根据自己的意愿尽可能地参与项目。以下是几种贡献方式:
+Apache Fory™ 是一个志愿者项目,依靠社区贡献蓬勃发展。
+无论您愿意投入多少精力,我们都诚邀您参与。以下是几种贡献方式:
-- 使用 Apache Fory™ 并分享使用体验和反馈问题;
-- 为项目提供最佳实践示例;
-- 报告错误并修复;
-- 贡献代码和参与文档建设。
+- 使用我们的项目并分享反馈。
+- 提供项目用例。
+- 报告 Bug 并贡献修复。
+- 贡献代码和改进文档。
## 邮件列表
-| 邮件列表 | 描述 | 订阅 | 取消订阅 | 发送邮件 | 活动 |
-| ----------------------- | ------------------ | ------------------------------------------------ | ------------------------------------------------------ | -------------------------------------- | -------------------------------------------------------------------------- |
-| dev@fory.apache.org | 开发相关讨论 | [订阅](mailto:dev-subscribe@fory.apache.org) | [取消订阅](mailto:dev-unsubscribe@fory.apache.org) | [发送邮件](mailto:dev@fory.apache.org) | [邮件列表活动](https://lists.apache.org/list.html?dev@fory.apache.org) |
-| commits@fory.apache.org | 仓库的所有 commits | [订阅](mailto:commits-subscribe@fory.apache.org) | [取消订阅](mailto:commits-unsubscribe@fory.apache.org) | 只读的邮件列表 | [邮件列表活动](https://lists.apache.org/list.html?commits@fory.apache.org) |
+| 名称 | 说明 | 订阅 | 取消订阅 | 发帖 | 存档 |
+| ----------------------- | ---------------- | ------------------------------------------------ | ------------------------------------------------------ | ---------------------------------- | ------------------------------------------------------------------ |
+| dev@fory.apache.org | 开发相关讨论 | [订阅](mailto:dev-subscribe@fory.apache.org) | [取消订阅](mailto:dev-unsubscribe@fory.apache.org) | [发帖](mailto:dev@fory.apache.org) | [存档](https://lists.apache.org/list.html?dev@fory.apache.org) |
+| commits@fory.apache.org | 仓库中的所有提交 | [订阅](mailto:commits-subscribe@fory.apache.org) | [取消订阅](mailto:commits-unsubscribe@fory.apache.org) | 只读列表 | [存档](https://lists.apache.org/list.html?commits@fory.apache.org) |
-在尝试发送邮件之前,请确保订阅上述的邮件列表。
+尝试发帖前,请务必先订阅相应的邮件列表。
-**如果您没有订阅邮件列表,您的邮件将被拒绝或不会收到回复。**
+如果您没有订阅邮件列表,您的消息将被拒绝,或者您将无法收到回复。
### 如何订阅邮件列表
-要发送邮件至邮件列表,请先通过以下方式订阅:
+要发布消息,请先按以下步骤订阅:
-1. 发送电子邮件至 listname-subscribe@fory.apache.org,并相应替换 `listname`;
-2. 回复您将收到的确认电子邮件,保持邮件主题行完整;
-3. 然后您将收到一封欢迎的电子邮件,订阅成功。
+1. 向 listname-subscribe@fory.apache.org 发送电子邮件,并相应替换 `listname`。
+2. 回复收到的确认邮件,并保持主题行不变。
+3. 随后您将收到欢迎邮件,表示订阅成功。
-在讨论电子邮件中的代码片段时,请确保:
+通过电子邮件讨论代码片段时,请确保:
-- 您不要链接到外部服务中的文件,因为此类文件可能会更改、被删除或链接可能会中断,从而使存档的电子邮件线程变得无用;
-- 您粘贴文本而不是文本屏幕截图;
-- 粘贴代码时保持格式,以保持代码可读;
-- 有足够的导入语句以避免产生代码歧义。
+- 不要链接到外部服务中的文件,因为这些文件可能会更改、被删除或链接可能失效,从而使存档的邮件讨论串失去价值。
+- 粘贴文本,而不是文字截图。
+- 粘贴代码时保留格式,以确保代码可读。
+- 包含足够的导入语句,以避免歧义。
## Slack
-您可以加入[Slack 上的 Apache Fory™ 社区](https://join.slack.com/t/fory-project/shared_invite/zt-1u8soj4qc-ieYEu7ciHOqA2mo47llS8A)。
+您可以加入 [Slack 上的 Apache Fory™ 社区](https://join.slack.com/t/fory-project/shared_invite/zt-1u8soj4qc-ieYEu7ciHOqA2mo47llS8A)。
-这里有一些社区规则:
+社区有以下几项规则:
-- 保持尊重和友善;
-- 所有重要的决定和结论都必须反映到邮件列表中。 “如果这没有在邮件列表中有相关的讨论记录,则代表它不生效” ;
-- [The Apache Way](https://theapacheway.com/on-list/);
-- 使用 Slack 线程来防止并行对话淹没当前的对话频道;
-- 请不要直接向邮件列表发送 Bug fix、Issue 分配和 Code Review 消息。这些内容应该被社区贡献者自愿处理并分配。
+- 相互尊重,友善交流。
+- 所有重要决定和结论都必须同步到邮件列表。“如果没有在邮件列表中发生,就等于没有发生。”——[Apache 格言](https://theapacheway.com/on-list/)。
+- 使用 Slack 讨论串,避免并行对话淹没频道。
+- 请勿通过私信请求他人协助排查问题、分配 Issue 或评审 PR。这些工作应由社区成员自愿认领。
-## Issue 跟踪
+## Issue 跟踪器
-我们使用 GitHub Issues 来跟踪所有 Issues:
+我们使用 GitHub Issues 跟踪所有问题:
- 代码相关问题:https://github.com/apache/fory/issues
- 网站相关问题:https://github.com/apache/fory-site/issues
-您需要有一个 [GitHub 帐号](https://github.com/signup) 才能创建问题。
-如果您没有 [GitHub 帐号](https://github.com/signup),您可以发送电子邮件至 dev@fory.apache.org。
+您需要拥有 [GitHub 账号](https://github.com/signup)才能创建 Issue。
+如果您没有 [GitHub 账号](https://github.com/signup),可以向 dev@fory.apache.org 发送电子邮件。
-### 报告 Bug
+### Bug 报告
-您在报告 Bug 之前,应该:
+报告 Bug 时:
-- 验证该 Bug 确实存在;
-- 搜索 [Issue List](https://github.com/apache/fory/issues) 以确保不存在相关 Bug。
-- 在 Issue List 中创建 [bug 报告](https://github.com/apache/fory/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml)。
-- 如果可能的话,深入研究 Apache Fory™ 的源代码,并针对您报告的 Bug 提交补丁,这有助于快速修复 Bug。
+- 确认该 Bug 确实存在。
+- 搜索 [Issue 跟踪器](https://github.com/apache/fory/issues),确认其中没有报告您所发现 Bug 的现有 Issue。
+- 在 Issue 跟踪器中创建 [Bug 报告](https://github.com/apache/fory/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml)。
+- 如果可以,请深入研究 Fory 源代码,并为您报告的 Bug 提交补丁,这有助于确保 Bug 得到快速修复。
### 报告安全漏洞
-Apache Fory™ 是 [Apache 软件基金会](https://apache.org/) 的一个项目,遵循 [ASF 漏洞处理流程](https://apache.org/security/#vulnerability-handling)。
+Apache Fory™ 是 [Apache 软件基金会](https://apache.org/)的项目,并遵循 [ASF 漏洞处理流程](https://apache.org/security/#vulnerability-handling)。
-要报告您发现的新的安全漏洞,请遵循 [ASF 漏洞报告流程](https://apache.org/security/#reporting-a-vulnerability),该流程解释了如何私下向社区维护者发送详细的漏洞信息。
+如需报告您发现的新漏洞,请遵循 [ASF 漏洞报告流程](https://apache.org/security/#reporting-a-vulnerability),该流程说明了如何私下向我们发送详细信息。
-### New Feature
+### 功能增强
-欢迎您增强功能或新功能建议。提案越具体、越合理,您在 Apache Fory™ 社区的影响力就越大。它有可能在之后版本发布。
+我们也欢迎功能增强或新功能提案。提案越具体、理由越充分,被纳入未来版本的可能性就越大。
-### 项目源代码
+## 源代码
-- Apache Fory™ Core 存储库:https://github.com/apache/fory
-- Apache Fory™ 网站存储库:https://github.com/apache/fory-site
+- Fory 核心仓库:https://github.com/apache/fory
+- Fory 网站仓库:https://github.com/apache/fory-site
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_join_community.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_join_community.md
index e24a366734..b9abbc3036 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_join_community.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_join_community.md
@@ -1,108 +1,105 @@
---
-title: 如何加入 Apache Fory™ 社区
+title: 如何加入 Apache Fory™
sidebar_position: 0
id: how_to_join_community
---
-首先为你选择加入开源贡献行列的行为点赞 👍🏻。再者,十分感谢你选择参与到 Apache Fory™ 社区,为这个开源项目做出贡献。
+首先,为您选择加入开源贡献者行列点赞。其次,非常感谢您选择参与 Fory 社区,并为这个开源项目贡献力量。
-## Apache Fory™ 贡献指南
+## Fory 贡献指南
-Apache Fory™ 团队通常在 github 上进行开发和 issue 维护,请打开 [Github 网站](https://github.com/),点击右上角 `Sign up` 按钮,注册一个自己的账号,开启你开源之旅的第一步。
+Fory 团队通常在 GitHub 上进行开发和维护 Issue。请打开 [GitHub 网站](https://github.com/),点击右上角的 `Sign up` 按钮,注册自己的账号,迈出开源之旅的第一步。
-在 [Apache Fory™ 仓库](https://github.com/apache/fory)中,我们有一份面向所有开源贡献者的[指南](https://fory.apache.org/zh-CN/docs/community/),介绍了有关版本管理、分支管理等内容,**请花几分钟时间阅读了解一下**。
+在 [Fory 仓库](https://github.com/apache/fory)中,我们为所有开源贡献者准备了一份[指南](https://fory.apache.org/zh-CN/docs/community/),其中介绍了版本管理和分支管理等内容。**请花几分钟时间阅读并理解它**。
-## 你的第一个 Pull Request
+## 您的第一个 Pull Request
-### Step0:安装 Git
+### 第 0 步:安装 Git
-Git 是一种版本控制系统,用于跟踪和管理软件开发项目中的代码变更。它帮助开发者记录和管理代码的历史记录,方便团队协作、代码版本控制、合并代码等操作。通过 Git,您可以追踪每个文件的每个版本,并轻松地在不同版本之间进行切换和比较。Git 还提供了分支管理功能,使得可以同时进行多个并行开发任务。
+Git 是一种版本控制系统,用于跟踪和管理软件开发项目中的代码变更。它可以帮助开发者记录和管理代码历史,便于团队协作、代码版本控制、代码合并等操作。借助 Git,您可以跟踪每个文件的各个版本,并轻松切换和比较不同版本。Git 还提供分支管理功能,允许同时开展多个并行开发任务。
-- 访问 Git 官方网站:[https://git-scm.com](https://git-scm.com)
+- 访问 Git 官方网站:[https://git-scm.com/] (https://git-scm.com/)
- 下载最新版本的 Git 安装程序。
-- 运行下载的安装程序,按照安装向导的提示进行安装。
-- 安装完成后,你可以通过命令行使用 `git version` 命令确认安装成功。
+- 运行下载的安装程序,并按照安装向导的提示完成安装。
+- 安装完成后,可以在命令行中使用 `git version` 命令确认是否安装成功。
-### Step1:Fork 项目
+### 第 1 步:Fork 项目
-- 首先需要 fork 这个项目,进入[Apache Fory™ 项目页面](https://github.com/apache/fory),点击右上角的 Fork 按钮
-- 你的 github 帐号中会出现 xxxx(你的 github 用户名)/fory 这个项目
-- 在本地电脑上使用以下命令: 得到一个 fory 文件夹
+- 首先,您需要 Fork 此项目。进入 [Fory 项目页面](https://github.com/apache/fory),然后点击右上角的 Fork 按钮。
+- 在您的 GitHub 账号中,将会出现 xxxx(您的 GitHub 用户名)/fory 项目。
+- 在本地计算机上,使用以下命令获取 fory 文件夹:
```
// ssh
-git clone git@github.com:xxxx(你的github用户名)/fory.git
+git clone git@github.com:xxxx (your GitHub username)/fory.git
// https
-git clone https://github.com/xxxx(你的github用户名)/fory.git
+git clone https://github.com/xxxx (your GitHub username)/fory.git
```
-### Step2:获取项目代码
+### 第 2 步:获取项目代码
-- 进入 fory 文件夹,添加 fory 的远程地址
+- 进入 fory 文件夹,并添加 fory 的远程地址:
```
git remote add upstream https://github.com/apache/fory.git
```
-### Step3:创建分支
+### 第 3 步:创建分支
-- 好了,现在可以开始贡献我们的代码了。fory 默认分支为 main 分支。无论是功能开发、bug 修复、文档编写,都请新建立一个分支,再合并到 main 分支上。使用以下代码创建分支:
+- 现在,您可以开始贡献代码了。Fory 的默认分支是 main 分支。无论是开发功能、修复 Bug 还是编写文档,请先创建新分支,再将其合并到 main 分支。使用以下代码创建分支:
-```shell
-// 创建功能开发分支
+```
+// Create a function development branch
git checkout -b feat/xxxx
-// 创建问题修复开发分支
+// Create a problem-fixing development branch
git checkout -b fix/xxxx
-// 创建文档、demo分支
+// Create a documentation, demo branch
git checkout -b docs/add-java-demo
```
-假设我们创建了文档修改分支 `docs/add-java-demo`
-
-- 假设我们已经添加了一些代码,提交到代码库
-
-- git add .
+假设我们已创建文档修改分支 `docs/add-java-demo`,添加了一些代码并将其提交到了代码仓库。
-- git commit -a -m "docs: add java demo and related docs" 。
+- `git add .`
+- `git commit -a -m "docs: add java demo and related docs"`
-### Step4:合并修改
+### 第 4 步:合并修改
-- 切换回自己的开发分支:
+- 切换回您的开发分支:
```
git checkout docs/add-java-demo
```
-- 把更新代码提交到自己的分支中:
+- 将更新后的代码提交到您的分支:
```
git push origin docs/add-java-demo
```
-### Step5:提交 Pull Request
+### 第 5 步:提交 Pull Request
-你可以在你的 github 代码仓库页面点击 `Compare & pull request` 按钮。或通过 `contribute` 按钮创建。
+您可以在 GitHub 代码仓库页面点击 `Compare & pull request` 按钮,也可以通过 `contribute` 按钮创建。
-- 填写这是什么类型的修改
-- 填写关联的 issue
-- 若有复杂变更,请说明背景和解决方案
+- 填写此次修改的类型。
+- 填写关联的 Issue。
+- 如果变更较为复杂,请说明背景和解决方案。
-相关信息填写完成后,点击 Create pull request 提交。
+填写相关信息后,点击 Create pull request 提交。
-## **轻松步入 Apache Fory™ 开源贡献之旅**
+## **轻松开启 Fory 开源贡献之旅**
-"**good first issue**" 是一个在开源社区常见的标签,这个标签的目的是帮助新贡献者找到适合入门的问题。
+“**good first issue**”是开源社区中的常见标签,目的是帮助新贡献者找到适合入门的 Issue。
-Apache Fory™ 的入门问题,你可以通过 [issue 列表](https://github.com/apache/fory/issues)查看。
+您可以通过 [Issue 列表](https://github.com/apache/fory/issues)查看 Fory 的入门 Issue。
-如果你当前**有时间和意愿**参与到社区贡献,可以在 issue 里看一看 **good first issue**,选择一个感兴趣、适合自己的认领。
+如果您目前**有时间也有意愿**参与社区贡献,可以查看 Issue 中的 **good first issue**,选择一个自己感兴趣且适合认领的 Issue。
-## 拥抱 Apache Fory™ 社区
+## 融入 Apache Fory™ 社区
-在你为 Apache Fory™ 贡献代码之余,我们鼓励你参与其他让社区更加繁荣的事情,比如:
+在为 Fory 贡献代码的同时,我们也鼓励您参与其他有助于社区繁荣的活动,例如:
-- 为项目的发展、功能规划 等提建议。
-- 创作文章、视频,开办讲座来宣传 Apache Fory™
-- 撰写推广计划,同团队一同执行。
+- 为项目发展、功能规划等提出建议。
+- 创作文章和视频,举办讲座来推广 Fory。
+- 编写推广计划,并与团队共同执行。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_release.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_release.md
index 247c95e26a..4c4acc258c 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_release.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_release.md
@@ -4,34 +4,34 @@ sidebar_position: 0
id: how_to_release
---
-本文主要介绍如何发布新版本的 Apache Fory™。
+本文主要介绍发布经理如何发布 Apache Fory™ 的新版本。
-## 介绍
+## 简介
-源代码发布是 Apache 最重视以及最重要的部分。
+源码发布是 Apache 最为重视的环节。
-请注意许可证和发布的软件签名问题。发布软件是一件严肃的事情,并会产生相应的法律后果。
+请特别注意许可证和签名问题。发布软件是一件严肃的事情,并会产生法律后果。
-## release manager 第一次发布
+## 首次担任发布经理
### 环境要求
-此发布过程在 Ubuntu 系统中运行,需要以下几个环境依赖:
+本发布流程在 Ubuntu 操作系统上执行,需要以下工具:
- OpenJDK 25+
- Apache Maven 3.6.3+
- Python 3.8+
- GnuPG 2.x
- Git
-- SVN(Apache 基金会使用 svn 来托管项目发布)
-- 可选的包发布和验证工具:Node.js LTS 和 npm、Rust via rustup、Go 1.24+、Dart、.NET SDK 8.0+、sbt
-- **设置环境变量**:如果您在不同的目录下配置了 gpg 密钥,请执行 `export GNUPGHOME=$(xxx)` 导出环境变量。
+- SVN(Apache 使用 SVN 托管项目发布版本)
+- 可选的软件包发布与验证工具:Node.js LTS 和 npm、通过 rustup 安装的 Rust、Go 1.24+、Dart、.NET SDK 8.0+ 以及 sbt
+- 请注意设置环境变量:如果将 GPG 密钥配置在其他目录中,请执行 `export GNUPGHOME=$(xxx)`
### 准备 GPG 密钥
-如果您是第一次作为软件发布者,您需要准备一个 GPG 密钥。
+如果您是第一次担任发布经理,需要准备一个 GPG 密钥。
-您可以参考这里的[快速开始](https://infra.apache.org/openpgp.html)获取一个 GPG 密钥或者获取更多相关信息。
+下面提供快速设置步骤。更多详情请参阅 [Apache OpenPGP 文档](https://infra.apache.org/openpgp.html)。
#### 安装 GPG
@@ -41,7 +41,7 @@ sudo apt install gnupg2
#### 生成 GPG 密钥
-请使用您的 Apache 名字和电子邮件地址生成 GPG 密钥:
+请使用您的 Apache 用户名和电子邮件地址生成密钥。
```bash
$ gpg --full-gen-key
@@ -106,15 +106,15 @@ uid [ultimate] Chaokun <ch...@apache.org>
sub rsa4096 2022-07-12 [E]
```
-#### 上传公钥至 GPG 密钥服务器
+#### 将公钥上传到公共 GPG 密钥服务器
-首先,列出您所创建的 GPG 密钥:
+首先,列出您的密钥:
```bash
gpg --list-keys
```
-执行相关命令之后,您将看到如下输出:
+输出类似如下:
```bash
--------------------------------------------------
@@ -130,48 +130,47 @@ sub rsa4096 2024-03-27 [E]
gpg --keyserver keys.openpgp.org --send-key <key-id> # e.g., 1E2CDAE4C08AD7D694D1CB139D7BE8E45E580BA4
```
-其中,`keys.openpgp.org` 是一个随机选择的密钥服务器,可以使用 keyserver.ubuntu.com 或任何其他功能完备的密钥服务器。
+这里随机选择了 `keys.openpgp.org` 作为密钥服务器,您也可以使用 keyserver.ubuntu.com 或其他功能完整的密钥服务器。
#### 检查密钥是否创建成功
-上传大约需要一分钟;之后,您可以通过电子邮件在相应的密钥服务器上检查。
+上传大约需要一分钟,之后可以通过相应密钥服务器的电子邮件验证功能进行检查。
-将密钥上传到密钥服务器的主要目的是为了加入一个可信的[信任网络](https://infra.apache.org/release-signing.html#web-of-trust)。
+将密钥上传到密钥服务器,主要是为了加入[信任网络(Web of Trust)](https://infra.apache.org/release-signing.html#web-of-trust)。
-#### 将 GPG 公钥添加到项目 KEYS 文件中
+#### 将 GPG 公钥添加到项目的 KEYS 文件
-发布分支的 svn 仓库是:https://dist.apache.org/repos/dist/release/fory
+发布分支的 SVN 仓库地址为:https://dist.apache.org/repos/dist/release/fory
-请在发布分支的 KEYS 中添加公钥:
+请将公钥添加到发布分支的 KEYS 文件中:
```bash
-svn co https://dist.apache.org/repos/dist/release/fory fory-dist
-# As this step will copy all the versions, it will take some time. If the network is broken, please use svn cleanup to delete the lock before re-execute it.
+svn co --depth=files https://dist.apache.org/repos/dist/release/fory fory-dist
cd fory-dist
(gpg --list-sigs YOUR_NAME@apache.org && gpg --export --armor YOUR_NAME@apache.org) >> KEYS # Append your key to the KEYS file
svn add . # It is not needed if the KEYS document exists before.
svn ci -m "add gpg key for YOUR_NAME" # Later on, if you are asked to enter a username and password, just use your apache username and password.
```
-#### 将 GPG 公钥上传到您的 GitHub 帐户
+#### 将 GPG 公钥上传到您的 GitHub 账户
-- 输入 `https://github.com/settings/keys` 以添加您的 GPG 密钥。
-- 如果添加后发现“未验证”字样,请将 GPG 密钥中使用的电子邮件地址绑定到您的 GitHub 帐户(https://github.com/settings/emails)。
+- 访问 https://github.com/settings/keys 添加您的 GPG 密钥。
+- 如果添加后显示 "unverified",请记得将 GPG 密钥使用的电子邮件地址绑定到您的 GitHub 账户(https://github.com/settings/emails)。
### 延伸阅读
-建议您在发布之前阅读以下文档,了解有关 Apache 基金会发布软件的更多详细信息,但这不是必须的:
+建议在发布前阅读以下文档,以进一步了解 Apache 发布流程,但这不是强制要求:
- 发布政策:https://www.apache.org/legal/release-policy.html
-- TLP 版本:https://infra.apache.org/release-distribution
-- 发布标志:https://infra.apache.org/release-signing.html
-- 发布发布:https://infra.apache.org/release-publishing.html
+- TLP 发布:https://infra.apache.org/release-distribution
+- 发布签名:https://infra.apache.org/release-signing.html
+- 发布软件:https://infra.apache.org/release-publishing.html
- 发布下载页面:https://infra.apache.org/release-download-pages.html
-- 发布 maven artifacts:https://infra.apache.org/publishing-maven-artifacts.html
+- 发布 Maven artifacts:https://infra.apache.org/publishing-maven-artifacts.html
-## 开始有关发布的讨论
+## 发起发布讨论
-通过发送电子邮件至以下地址发起有关下一个版本的讨论:dev@fory.apache.org:
+向 dev@fory.apache.org 发送电子邮件,发起关于下一版本的讨论:
标题:
@@ -179,7 +178,7 @@ svn ci -m "add gpg key for YOUR_NAME" # Later on, if you are asked to enter a us
[DISCUSS] Release Apache Fory ${release_version}
```
-内容:
+正文:
```
Hello, Apache Fory Community,
@@ -199,33 +198,34 @@ ${name}
## 准备发布
-如果讨论结果中没有出现反对声音,您需要做一些发布版本的准备工作。
+如果讨论结果积极,则需要准备发布 artifacts。
### GitHub 分支和标签
-- 创建一个名为 `releases-${release_version}` 的分支。也可以运行 `python ci/release.py prepare -v ${release_version}`,让脚本创建分支、更新所有版本并创建准备提交。
-- 如果没有使用 `prepare`,通过执行命令 `python ci/release.py bump_version -l all -version ${release_version}` 将版本升级到 `${release_version}`
-- 执行 git commit 并将分支推送到 `git@github.com:apache/fory.git`
-- 通过 `git tag v${release_version}-${rc_version}` 创建一个 release candidate 标签,然后将其推送到 `git@github.com:apache/fory.git`
-- 如果本次发布包含 `go/fory` 这个 Go 子模块,请在投票通过后额外创建并推送 Go 子模块标签。例如,对于最终版 `${release_version}`,执行:
+- 创建名为 `releases-${release_version}` 的新分支。也可以运行 `python ci/release.py prepare -v ${release_version}` 来创建分支、更新所有版本并创建准备提交。
+- 将版本更新为 `${release_version}`:请执行命令 `python ci/release.py bump_version -l all -version ${release_version}`,但使用 `prepare` 时无需执行。
+- 创建 Git 提交并将分支推送到 `git@github.com:apache/fory.git`。
+- 使用 `git tag v${release_version}-${rc_version}` 创建新的候选发布标签,然后将其推送到 `git@github.com:apache/fory.git`。
+- 如果本次发布包含 `go/fory` 下的 Go 模块,请在投票通过后创建并推送 Go 子模块标签。例如,对于最终的 `${release_version}` 版本:
```bash
+git remote add apache git@github.com:apache/fory.git
git tag go/fory/v${release_version}
git push apache go/fory/v${release_version}
```
### 构建 artifacts 并上传到 SVN dist/dev 仓库
-首先,您需要通过 `python ci/release.py build -v ${release_version}` 构建预发布 artifacts。
+首先,执行 `python ci/release.py build -v ${release_version}` 构建源码发布 artifacts。
-然后您需要把它上传到 svn dist repo。dev 分支的 dist 仓库地址是:https://dist.apache.org/repos/dist/dev/fory
+然后,将其上传到 SVN dist 仓库。dev 分支的 dist 仓库地址为:https://dist.apache.org/repos/dist/dev/fory
```bash
# As this step will copy all the versions, it will take some time. If the network is broken, please use svn cleanup to delete the lock before re-execute it.
svn co https://dist.apache.org/repos/dist/dev/fory fory-dist-dev
```
-然后,上传项目:
+然后上传 artifacts:
```bash
cd fory-dist-dev
@@ -243,32 +243,95 @@ svn status
svn commit -m "Prepare for fory ${release_version}-${rc_version}"
```
-访问 https://dist.apache.org/repos/dist/dev/fory/ 以检查 artifacts 是否正确上传。
+访问 https://dist.apache.org/repos/dist/dev/fory/ 检查 artifacts 是否已正确上传。
-### 如果出现问题该怎么办
+### 出现问题时如何处理
-如果某些文件是意外出现或者发生某些错误,则需要删除相关内容并执行 `svn delete`,然后重复上述上传过程。
+如果出现非预期文件,请使用 `svn delete` 删除,然后重复上述上传流程。
## 投票
-新版本发布需要 Apache Fory 社区的投票。
+### 检查版本
+
+Fory 发布需要获得 Fory 社区的投票。
+
+- release_version:Fory 的版本,例如 1.0.0。
+- release_candidate_version:用于投票的版本,例如 1.0.0-rc1。
+- maven_artifact_number:Maven 暂存 artifacts 的编号,例如 1001。可以在 https://repository.apache.org/#stagingRepositories 上搜索 "fory" 找到该编号。
+
+### 构建 Fory 源码并发布到 Nexus
+
+#### 配置 Apache 账户密码
+
+将 Fory 发布到 Nexus 之前,需要安全地配置 Apache 账户凭据。由于密码必须加密,此步骤至关重要。
+
+首先,打开 Maven 全局设置文件 `settings.xml`,该文件通常位于 `~/.m2/settings.xml`。添加或修改以下部分:
+
+```xml
+
+<servers>
+ <server>
+ <id>apache.snapshots.https</id>
+ <username>your-apache-username</username>
+ <password>{your-encrypted-password}</password>
+ </server>
+ <server>
+ <id>apache.releases.https</id>
+ <username>your-apache-username</username>
+ <password>{your-encrypted-password}</password>
+ </server>
+</servers>
+```
+
+**重要说明:**
+
+- 将 `your-apache-username` 替换为您的 Apache LDAP 用户名。
+- 密码必须使用 Maven 密码加密工具进行加密。
+- 加密后的密码应放在花括号 `{}` 中。
+
+有关详细的加密说明,请参阅官方文档:[发布 Maven Artifacts](https://infra.apache.org/publishing-maven-artifacts.html)
+
+密码加密步骤如下:
+
+1. 生成主密码(如果尚未生成):
+
+2. ```sh
-- release_version:Fory 的版本,如 1.0.0。
-- release_candidate_version:投票的版本,如 1.0.0-rc1。
-- maven_artifact_number:Maven 暂存 artifacts 的数量。如 1001. 具体来说,可以通过搜索 “fory” 来找到 maven_artifact_number https://repository.apache.org/#stagingRepositories.
+ mvn --encrypt-master-password your-master-password
-### 构建并发布 Java、Kotlin 和 Scala 模块
+ ```
-在仓库根目录运行 JVM 发布命令。默认情况下,脚本会依次发布 Java、Kotlin 和 Scala:
+ 将输出保存到 `~/.m2/settings-security.xml`:
+
+3. ```xml
+
+ <settingsSecurity>
+ <master>{your-encrypted-master-password}</master>
+ </settingsSecurity>
+
+ ```
+
+4. 加密您的 Apache 账户密码:
+
+ ```sh
+
+ mvn --encrypt-password your-apache-password
+
+ ```
+
+ 将加密后的输出写入 `password` 字段(位于 `settings.xml` 中)。
+
+#### 构建并发布 Java、Kotlin 和 Scala 模块
+
+在仓库根目录运行 JVM 发布命令。默认情况下,它会依次发布 Java、Kotlin 和 Scala:
```sh
python ci/release.py publish_jvm
```
-发布脚本会选择 OpenJDK 25 运行时,在正确的模块目录中执行发布命令,并校验 `fory-core` 的 multi-release
-二进制 JAR 和源码 JAR。在 macOS 以外的平台上,请先安装 OpenJDK 25,并正确设置 `JAVA_HOME` 和 `PATH`。
+发布脚本会选择 OpenJDK 25 运行时,在正确的模块目录中执行各模块的发布命令,并验证 `fory-core` 的 multi-release 二进制 JAR 和源码 JAR。在 macOS 以外的平台上,请先安装 OpenJDK 25,并在运行命令前设置 `JAVA_HOME` 和 `PATH`。
-如需重新发布或单独发布某个模块,请使用对应命令:
+如需重新运行或逐个发布模块,请使用相应命令:
```sh
python ci/release.py publish_java
@@ -276,12 +339,31 @@ python ci/release.py publish_kotlin
python ci/release.py publish_scala
```
-单独执行这些命令时,请先发布 Java,并保留 `java/fory-core/target` 下生成的 artifacts。Kotlin 和 Scala
-发布流程需要使用这些 artifacts 完成最终的 `fory-core` 发布 JAR 校验。
+单独使用这些命令时,请先发布 Java,并保留在 `java/fory-core/target` 下生成的 artifacts。Kotlin 和 Scala 发布流程需要使用这些 artifacts 完成最终的 `fory-core` 发布 JAR 验证。
+
+#### 在 Nexus 中关闭 Maven 暂存仓库
+
+完成所有模块的发布后,在 Nexus 中执行以下步骤:
+
+1. 登录 Apache Nexus 仓库管理界面。
+2. 前往暂存仓库页面。
+3. 找到最新的 Fory 暂存仓库,例如 `orgapachefory-1001`。
+4. 执行 "Close" 操作,验证所有已上传的 artifacts。
+5. 记录暂存仓库 ID,以便写入投票邮件。
+6. 在投票通过之前,不要执行 "Release" 操作。
+
+这些步骤可确保所有暂存 artifacts 在社区投票前都已通过验证。
+
+### 构建预发布版本
+
+投票前需要构建一个预发布版本,例如:
+https://github.com/apache/fory/releases/tag/v${release_version}-${rc_version}
+
+推送 `v*` 标签会触发 Python、compiler、JavaScript、Rust、Dart 和 C# 基于标签的软件包发布工作流。对于包含 `-` 的候选发布标签,各工作流会在相应生态系统支持的情况下发布预发布或暂存 artifacts,例如将 Python 软件包发布到 TestPyPI,以及为 npm 软件包使用 `next` 标签。开始投票前,请监控所有触发的工作流。
### Fory 社区投票
-发送电子邮件至 Fory Community:dev@fory.apache.org:
+向 Fory 社区 dev@fory.apache.org 发送电子邮件:
标题:
@@ -289,7 +371,7 @@ python ci/release.py publish_scala
[VOTE] Release Apache Fory v${release_version}-${rc_version}
```
-内容:
+正文:
```
Hello, Apache Fory Community:
@@ -301,8 +383,10 @@ Apache Fory is a blazingly fast multi-language serialization framework
for idiomatic domain objects, schema IDL, and cross-language data
exchange.
-The change lists about this release:
+The discussion thread:
+https://lists.apache.org/thread/xxr3od301g6v3ndj14zqc05byp9qvclh
+The change lists about this release:
https://github.com/apache/fory/compare/v${previous_release_version}...v${release_version}-${rc_version}
The release candidates:
@@ -314,7 +398,7 @@ https://repository.apache.org/content/repositories/orgapachefory-${maven_artifac
Git tag for the release:
https://github.com/apache/fory/releases/tag/v${release_version}-${rc_version}
-如果本次发布还包含 Go 模块,请同时附上 Go 子模块标签:
+If this release also publishes the Go module, include the Go submodule tag too:
https://github.com/apache/fory/releases/tag/go/fory/v${release_version}
Git commit for the release:
@@ -346,11 +430,27 @@ To learn more about Fory, please see https://fory.apache.org/
How to Build and Test, please refer to: https://github.com/apache/fory/blob/main/docs/development/building.md
+
Thanks,
-Chaokun Yang
+${name}
+```
+
+在获得至少 3 票来自 Apache Fory PMC 成员且具有约束力的 +1 票,并且没有否决票后,请先回复上述投票邮件线程,通知投票已经结束。
+
+```
+Hi all,
+
+The vote for Release Apache Fory v${release_version}-${rc_version} is closed now.
+
+Thanks to everyone for helping checking and voting for the release.
+
+I will close the vote later in another thread.
+
+Best,
+${name}
```
-在至少获得 3 个来自 Apache Fory PMC member 的 binding +1,并且没有收到否决票之后,发布投票结果:
+随后立即发起一个新邮件线程,公布投票结果。
标题:
@@ -358,7 +458,7 @@ Chaokun Yang
[RESULT][VOTE] Release Apache Fory v${release_version}-${rc_version}
```
-内容:
+正文:
```
Hello, Apache Fory Community,
@@ -380,42 +480,76 @@ Thanks,
${name}
```
-### 如果投票失败怎么办
+### 投票失败时如何处理
-如果投票失败,请单击“删除”以删除暂存的 Maven artifacts。
+如果投票失败,请点击 "Drop" 删除暂存的 Maven artifacts。
-解决提出的问题,然后再次提出 `rc_version` 的新投票。
+解决提出的问题,然后递增 `rc_version` 并重新发起投票。
-## 官方发布
+## 正式发布
### 将 artifacts 发布到 SVN 发布目录
-- release_version:Fory 的发布版本,如 1.0.0
-- release_candidate_version:投票版本,如 1.0.0-rc1
+- release_version:Fory 的发布版本,例如 1.0.0。
+- release_candidate_version:用于投票的版本,例如 1.0.0-rc1。
```bash
svn mv https://dist.apache.org/repos/dist/dev/fory/${release_version}-${rc_version} https://dist.apache.org/repos/dist/release/fory/${release_version} -m "Release fory ${release_version}"
```
-### 更改 Fory 网站下载链接
+发布 release_version 时,如果 https://dist.apache.org/repos/dist/dev/fory/ 仓库中还留有过期的 release_candidate_version,请将其清理,以保持 dev 仓库整洁。
-提交 PR 到 https://github.com/apache/fory-site 仓库更新 Fory 版本,[下载页面](https://fory.apache.org/download)
+当 `https://archive.apache.org/dist/fory/${release_version}/` 可访问时,即可确认 release_version 已成功发布并归档。此时可以清理发布仓库中的上一发布版本,仅保留当前版本。
-同时更新 release blog、download page、checksum/signature 示例、release notes 链接、current docs、zh-CN 翻译、`${release_version}` 的 versioned docs snapshot、`versions.json` 以及 `docusaurus.config.ts` 默认 docs 版本。
+### 更新 Fory 和 Fory-Site 内容
-### GitHub 正式发布
+向 https://github.com/apache/fory-site 提交 PR 以更新 Fory-Site。
+参考实现:[#283](https://github.com/apache/fory-site/pull/283) 和 [#285](https://github.com/apache/fory-site/pull/285)。
-投票通过后,从通过投票的 commit 创建并推送最终 tag `v${release_version}`。该 tag 会触发 Python、compiler、JavaScript、Rust、Dart 和 C# 的最终包发布 workflows。发送公告前,请监控所有 workflows 直到完成。
+#### 更新 Fory-Site
+
+通常需要修改以下关键部分:
+
+1. 编写一则新公告,例如:
+ 在 blog 目录下添加新的 Markdown 文件:
+
+```
+The Apache Fory team is pleased to announce the [?] release. This is a major release that includes [? PR](https://github.com/apache/fory/compare/v[?]...v[?]) from ? distinct contributors. See [Getting Started](https://fory.apache.org/docs/start/) to choose a runtime and install the libraries for your platform.
+```
+
+2. 将旧版本号更新为新版本号。
+ 例如,更新开发分支和最新发布分支的 [Java 配置](https://fory.apache.org/docs/start/java)及其链接的功能指南:
+
+```
+<dependency>
+ <groupId>org.apache.fory</groupId>
+ <artifactId>fory-core</artifactId>
+ <version>0.11.2</version>
+</dependency>
+```
+
+3. 更新下载页面、校验和与签名示例、发布说明链接、current 文档、zh-CN 翻译、versioned docs 快照、`versions.json` 以及 `docusaurus.config.ts` 中的默认文档版本。
+
+#### 更新 Fory
+
+向 https://github.com/apache/fory 提交 PR,更新 [README](https://github.com/apache/fory/blob/main/README.md)、下一开发版本的软件包元数据,以及应指向最新发布版本的面向用户的安装代码片段。
+
+### 在 GitHub 上正式发布
+
+需要在 Fory 项目中正式发布此版本。
+参考实现:https://github.com/apache/fory/releases/tag/v${release_version}
+
+投票通过后,根据通过投票的提交创建并推送最终的 `v${release_version}` 标签。此标签会触发 Python、compiler、JavaScript、Rust、Dart 和 C# 的最终软件包发布工作流。发送公告前,请监控每个工作流直至完成。
### 发布 Maven artifacts
-- maven_artifact_number:Maven 暂存 artifacts 的数量。如 1001。
-- 打开https://repository.apache.org/#stagingRepositories.
-- 找到 artifacts `orgapachefory-${maven_artifact_number}`,点击“发布”。
+- maven_artifact_number:Maven 暂存 artifacts 的编号,例如 1001。
+- 打开 https://repository.apache.org/#stagingRepositories。
+- 找到 artifact `orgapachefory-${maven_artifact_number}`,点击 "Release"。
### 发送公告
-将发布公告发送给 dev@fory.apache.org 并且抄送给 announce@apache.org。
+将发布公告发送到 dev@fory.apache.org,并抄送 announce@apache.org。
标题:
@@ -423,7 +557,7 @@ svn mv https://dist.apache.org/repos/dist/dev/fory/${release_version}-${rc_versi
[ANNOUNCE] Apache Fory ${release_version} released
```
-内容:
+正文:
```
Hi all,
@@ -468,4 +602,6 @@ Best Regards,
${your_name}
```
-至此,整个发布流程结束。
+请使用纯文本而不是富文本格式,否则抄送 announce@apache.org 时邮件可能会被拒收。
+
+完成以上步骤后,Fory 发布流程至此结束。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_verify.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_verify.md
index 150fb90cf6..01a3db3e04 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_verify.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/community/how_to_verify.md
@@ -1,21 +1,21 @@
---
-title: 如何验证 Apache Fory™
+title: 如何验证
sidebar_position: 0
id: how_to_verify
---
-## 下载 Apache Fory™
+## 下载候选版本
```bash
-# If there is svn locally, you can clone to the local
-svn co https://dist.apache.org/repos/dist/dev/incubator/fory/${release_version}-${rc_version}/
+#If there is svn locally, you can clone to the local
+svn co https://dist.apache.org/repos/dist/dev/fory/${release_version}-${rc_version}/
# You can download the material file directly
-wget https://dist.apache.org/repos/dist/dev/incubator/fory/${release_version}-${rc_version}/xxx.xxx
+wget https://dist.apache.org/repos/dist/dev/fory/${release_version}-${rc_version}/xxx.xxx
```
-## 验证 checksums 和 signatures
+## 验证校验和与签名
-首先,您需要安装 gpg:
+首先需要安装 gpg:
```bash
apt-get install gnupg
@@ -25,10 +25,10 @@ yum install gnupg
brew install gnupg
```
-之后,导入 Apache Fory release manager 的公钥:
+然后导入 Fory 发布经理的公钥:
```bash
-curl https://downloads.apache.org/incubator/fory/KEYS > KEYS # Download KEYS
+curl https://downloads.apache.org/fory/KEYS > KEYS # Download KEYS
gpg --import KEYS # Import KEYS to local
# Then, trust the public key:
gpg --edit-key <KEY-used-in-this-version> # Edit the key(mentioned in vote email)
@@ -76,10 +76,10 @@ unless you restart the program.
for i in *.tar.gz; do echo $i; gpg --verify $i.asc $i; done
```
-如果出现如下内容,则表示签名正确:
+如果出现类似以下内容,则表示签名正确:
```bash
-apache-fory-0.5.0-src.tar.gz
+apache-fory-0.12.0-src.tar.gz
gpg: Signature made Wed 17 Apr 2024 11:49:45 PM CST using RSA key ID 5E580BA4
gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
@@ -87,33 +87,39 @@ gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: Good signature from "chaokunyang (CODE SIGNING KEY) <ch...@apache.org>"
```
-然后验证 checksum:
+然后验证校验和:
```bash
-for i in *.tar.gz; do echo $i; sha512sum --check $i.sha512; done
+for i in *.tar.gz; do echo $i; sha512sum --check $i.sha512*; done
```
-它应该输出如下内容:
+输出应类似于:
```bash
apache-fory-0.12.0-src.tar.gz
apache-fory-0.12.0-src.tar.gz: OK
```
-## 检查源码包中的文件
+快速完成上述验证的方法是:
+
+```bash
+curl -s https://raw.githubusercontent.com/apache/fory/main/ci/release.py | python3 - verify -v 0.5.0
+```
+
+## 检查源代码包的文件内容
-解压缩 `apache-fory-${release_version}-${rc_version}-src.tar.gz` 并检查以下内容:
+解压 `apache-fory-${release_version}-${rc_version}-src.tar.gz`,并检查以下内容:
-- 此存储库 LICENSE 和 NOTICE 文件是正确的;
-- 如有必要,所有文件都有 ASF 许可证标头;
-- 项目构建通过。
+- LICENSE 和 NOTICE 文件对于该仓库是正确的。
+- 所有需要许可证头的文件都带有 ASF 许可证头。
+- 可以正常构建。
-## 检查 fory-java 的 Maven artifacts
+## 检查 fory-java 的 Maven 制品
-下载 Apache Fory™:https://repository.apache.org/content/repositories/orgapachefory-${maven_artifact_number}/.
+从 https://repository.apache.org/content/repositories/orgapachefory-${maven_artifact_number}/ 下载制品。
-您可以检查以下内容:
+可以检查以下内容:
-- JAR 的 Checksum 与项目绑定的 checksum 文件一致。
-- JAR 的 signature 与项目绑定的 signature 文件一致。
-- JAR 在本地是可重复的。这意味着您可以在计算机上构建 JAR,并验证 checksum 和与项目绑定的相同。
+- JAR 的校验和与随附的校验和文件一致。
+- JAR 的签名与随附的签名文件一致。
+- JAR 可以在本地复现。这意味着您可以在自己的计算机上构建 JAR,并验证其校验和与随附制品的校验和相同。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/_category_.json b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/_category_.json
index abf19e9fcb..eece8717d2 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/_category_.json
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/_category_.json
@@ -1,6 +1,6 @@
{
- "position": 3,
- "label": "Schema IDL 与编译器",
+ "position": 7,
+ "label": "Fory IDL 与编译器",
"collapsible": true,
"collapsed": true
}
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/build-integration.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/build-integration.md
new file mode 100644
index 0000000000..c391e7d184
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/build-integration.md
@@ -0,0 +1,230 @@
+---
+title: 构建集成
+sidebar_position: 2
+id: build-integration
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## Maven (Java)
+
+添加到 `pom.xml`:
+
+```xml
+<build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <id>generate-fory-types</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>foryc</executable>
+ <arguments>
+ <argument>${project.basedir}/src/main/fdl/schema.fdl</argument>
+ <argument>--java_out</argument>
+ <argument>${project.build.directory}/generated-sources/fory</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+</build>
+```
+
+添加生成的源代码:
+
+```xml
+<build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.4.0</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources/fory</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+</build>
+```
+
+## Gradle (Java/Kotlin)
+
+添加到 `build.gradle`:
+
+```groovy
+task generateForyTypes(type: Exec) {
+ commandLine 'foryc',
+ "${projectDir}/src/main/fdl/schema.fdl",
+ '--java_out', "${buildDir}/generated/sources/fory"
+}
+
+compileJava.dependsOn generateForyTypes
+
+sourceSets {
+ main {
+ java {
+ srcDir "${buildDir}/generated/sources/fory"
+ }
+ }
+}
+```
+
+## Python (setuptools)
+
+添加到 `setup.py` 或 `pyproject.toml`:
+
+```python
+# setup.py
+from setuptools import setup
+from setuptools.command.build_py import build_py
+import subprocess
+
+class BuildWithForyIdl(build_py):
+ def run(self):
+ subprocess.run([
+ 'foryc',
+ 'schema.fdl',
+ '--python_out', 'src/generated'
+ ], check=True)
+ super().run()
+
+setup(
+ cmdclass={'build_py': BuildWithForyIdl},
+ # ...
+)
+```
+
+## Go (go generate)
+
+添加到 Go 文件:
+
+```go
+//go:generate foryc ../schema.fdl --lang go --output .
+package models
+```
+
+运行:
+
+```bash
+go generate ./...
+```
+
+## Rust (build.rs)
+
+添加到 `build.rs`:
+
+```rust
+use std::process::Command;
+
+fn main() {
+ println!("cargo:rerun-if-changed=schema.fdl");
+
+ let status = Command::new("foryc")
+ .args(&["schema.fdl", "--rust_out", "src/generated"])
+ .status()
+ .expect("Failed to run foryc");
+
+ if !status.success() {
+ panic!("Fory IDL compilation failed");
+ }
+}
+```
+
+## CMake (C++)
+
+添加到 `CMakeLists.txt`:
+
+```cmake
+find_program(FORY_COMPILER foryc)
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/generated/example.h
+ COMMAND ${FORY_COMPILER}
+ ${CMAKE_CURRENT_SOURCE_DIR}/schema.fdl
+ --cpp_out ${CMAKE_CURRENT_SOURCE_DIR}/generated
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/schema.fdl
+ COMMENT "Generating Fory IDL types"
+)
+
+add_custom_target(generate_fory_idl DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/generated/example.h)
+
+add_library(mylib ...)
+add_dependencies(mylib generate_fory_idl)
+target_include_directories(mylib PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/generated)
+```
+
+## Bazel
+
+在 `BUILD` 中创建规则:
+
+```python
+genrule(
+ name = "generate_fdl",
+ srcs = ["schema.fdl"],
+ outs = ["generated/example.h"],
+ cmd = "$(location //:fory_compiler) $(SRCS) --cpp_out $(RULEDIR)/generated",
+ tools = ["//:fory_compiler"],
+)
+
+cc_library(
+ name = "models",
+ hdrs = [":generate_fdl"],
+ # ...
+)
+```
+
+## Dart / Flutter
+
+将 Fory 依赖添加到 `pubspec.yaml`:
+
+```yaml
+dependencies:
+ fory: ^1.5.0
+
+dev_dependencies:
+ build_runner: ^2.4.0
+```
+
+使用编译器生成 Schema 类型:
+
+```bash
+foryc schema.fdl --dart_out=lib/generated
+```
+
+然后运行 `build_runner` 生成序列化器:
+
+```bash
+dart run build_runner build
+```
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/cli.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/cli.md
new file mode 100644
index 0000000000..cc145e0148
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/cli.md
@@ -0,0 +1,670 @@
+---
+title: 编译器 CLI
+sidebar_position: 4
+id: cli
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## 命令行界面
+
+### 基本用法
+
+```bash
+foryc [OPTIONS] FILES...
+```
+
+```bash
+foryc --scan-generated [OPTIONS]
+```
+
+### 选项
+
+编译选项:
+
+| 选项 | 说明 | 默认值 |
+| ------------------------------------- | ------------------------------------------------ | ------------- |
+| `--lang` | 以逗号分隔的目标语言 | `all` |
+| `--output`, `-o` | 输出目录 | `./generated` |
+| `-I`, `--proto_path`, `--import_path` | 向导入搜索路径添加目录(可重复指定) | (无) |
+| `--java_out=DST_DIR` | 在 DST_DIR 中生成 Java 代码 | (无) |
+| `--python_out=DST_DIR` | 在 DST_DIR 中生成 Python 代码 | (无) |
+| `--cpp_out=DST_DIR` | 在 DST_DIR 中生成 C++ 代码 | (无) |
+| `--go_out=DST_DIR` | 在 DST_DIR 中生成 Go 代码 | (无) |
+| `--rust_out=DST_DIR` | 在 DST_DIR 中生成 Rust 代码 | (无) |
+| `--csharp_out=DST_DIR` | 在 DST_DIR 中生成 C# 代码 | (无) |
+| `--javascript_out=DST_DIR` | 在 DST_DIR 中生成 JavaScript/TypeScript 代码 | (无) |
+| `--swift_out=DST_DIR` | 在 DST_DIR 中生成 Swift 代码 | (无) |
+| `--dart_out=DST_DIR` | 在 DST_DIR 中生成 Dart 代码 | (无) |
+| `--scala_out=DST_DIR` | 在 DST_DIR 中生成 Scala 3 代码 | (无) |
+| `--kotlin_out=DST_DIR` | 在 DST_DIR 中生成 Kotlin 代码 | (无) |
+| `--go_nested_type_style` | Go 嵌套类型命名风格:`camelcase` 或 `underscore` | `underscore` |
+| `--swift_namespace_style` | Swift 命名空间风格:`enum` 或 `flatten` | `enum` |
+| `--emit-fdl` | 输出转换后的 FDL(用于非 FDL 输入) | `false` |
+| `--emit-fdl-path` | 将转换后的 FDL 写入此路径(文件或目录) | (标准输出) |
+| `--grpc` | 为支持的输出生成 gRPC 服务配套代码 | `false` |
+| `--grpc-python-mode=MODE` | Python gRPC 模式:`async` 或 `sync` | `async` |
+| `--grpc-web` | 生成 JavaScript gRPC-Web 客户端配套代码 | `false` |
+
+编译器支持使用 Schema 级文件选项控制特定语言的生成行为。
+当 `go_nested_type_style` 和 `swift_namespace_style` 同时出现在 CLI 与 Schema 中时,CLI 标志优先。
+Rust 时间类型代码生成没有 CLI 标志:在 Schema 中设置
+`option rust_use_chrono_temporal_types = true;`,即可生成
+`chrono::NaiveDate`、`chrono::NaiveDateTime` 和 `chrono::Duration`,而不是默认的
+`fory::Date`、`fory::Timestamp` 和 `fory::Duration`。编译这些基于 chrono 的 Rust 生成代码时,
+crate 必须依赖 `chrono` 并启用 Fory 的 `chrono` feature。
+
+扫描选项(与 `--scan-generated` 一起使用):
+
+| 选项 | 说明 | 默认值 |
+| ------------ | ---------------------- | ------- |
+| `--root` | 要扫描的根目录 | `.` |
+| `--relative` | 输出相对于根目录的路径 | `false` |
+| `--delete` | 删除匹配的生成文件 | `false` |
+| `--dry-run` | 仅扫描并输出,不删除 | `false` |
+
+### 扫描生成文件
+
+使用 `--scan-generated` 查找 `foryc` 生成的文件。扫描器会递归遍历目录树,
+跳过 `build/`、`target/` 和隐藏目录,并在发现每个生成文件时输出其路径。
+
+```bash
+# Scan current directory
+foryc --scan-generated
+
+# Scan a specific root
+foryc --scan-generated --root ./src
+
+# Print paths relative to the scan root
+foryc --scan-generated --root ./src --relative
+
+# Delete scanned generated files
+foryc --scan-generated --root ./src --delete
+
+# Dry-run (scan and print only)
+foryc --scan-generated --root ./src --dry-run
+```
+
+### 示例
+
+**为所有语言编译:**
+
+```bash
+foryc schema.fdl
+```
+
+**为选定的语言子集编译:**
+
+```bash
+foryc schema.fdl --lang java,python,csharp,javascript,swift,dart,kotlin
+```
+
+**指定输出目录:**
+
+```bash
+foryc schema.fdl --output ./src/generated
+```
+
+**编译多个文件:**
+
+```bash
+foryc user.fdl order.fdl product.fdl --output ./generated
+```
+
+**编译包含服务定义的简单 Schema(Java + Python + Go + Rust + C# + Dart + Scala + Kotlin + JavaScript 模型):**
+
+```bash
+foryc compiler/examples/service.fdl --java_out=./generated/java --python_out=./generated/python --go_out=./generated/go --rust_out=./generated/rust --csharp_out=./generated/csharp --dart_out=./generated/dart --scala_out=./generated/scala --kotlin_out=./generated/kotlin --javascript_out=./generated/javascript
+```
+
+**生成 Java、Python、Go、Rust、C++、C#、Dart、Scala、Kotlin 和 Node.js JavaScript gRPC 服务配套代码:**
+
+```bash
+foryc compiler/examples/service.fdl --java_out=./generated/java --python_out=./generated/python --go_out=./generated/go --rust_out=./generated/rust --cpp_out=./generated/cpp --csharp_out=./generated/csharp --dart_out=./generated/dart --scala_out=./generated/scala --kotlin_out=./generated/kotlin --javascript_out=./generated/javascript --grpc
+```
+
+生成的 gRPC 服务代码使用 Fory 序列化请求和响应载荷。Java 输出导入 grpc-java API,Python 输出默认使用
+`grpc.aio`,Go 输出导入 grpc-go,Rust 输出导入 `tonic` 和 `bytes`;
+C++ 输出包含 gRPC C++ 的 `grpcpp` 头文件,编译它的目标必须将生成代码目录加入 include 路径,
+并链接 `fory::serialization` 和 `gRPC::grpc++`。
+Scala 输出导入 grpc-java API;Kotlin 输出导入 grpc-java 和 grpc-kotlin API,并使用协程 stub。
+C# 输出导入 `Grpc.Core.Api` 类型,可以通过 `Grpc.AspNetCore` 等常规 .NET gRPC 包托管,
+也可以通过 `Grpc.Net.Client` 调用。Dart 输出导入 `package:grpc`。
+JavaScript 输出导入 `@grpc/grpc-js`。
+编译或运行这些生成服务文件的应用必须自行提供 gRPC 依赖。Fory 软件包不会为此功能引入强制 gRPC 依赖。
+
+对于现有的同步 `grpcio` 应用,可使用以下命令生成同步 Python gRPC 配套代码:
+
+```bash
+foryc compiler/examples/service.fdl --python_out=./generated/python --grpc --grpc-python-mode=sync
+```
+
+**生成 JavaScript gRPC-Web 浏览器客户端:**
+
+```bash
+foryc compiler/examples/service.fdl --javascript_out=./generated/javascript --grpc-web
+```
+
+如果同一份 JavaScript 输出需要同时包含 Node.js 和浏览器配套代码,请同时使用 `--grpc` 和 `--grpc-web`。
+浏览器配套代码会导入 `grpc-web`;应用必须提供该软件包以及与 gRPC-Web 兼容的服务器或代理。
+
+**使用导入搜索路径:**
+
+```bash
+# Add a single import path
+foryc src/main.fdl -I libs/common
+
+# Add multiple import paths (repeated option)
+foryc src/main.fdl -I libs/common -I libs/types
+
+# Add multiple import paths (comma-separated)
+foryc src/main.fdl -I libs/common,libs/types,third_party/
+
+# Using --proto_path (protoc-compatible alias)
+foryc src/main.fdl --proto_path=libs/common
+
+# Mix all styles
+foryc src/main.fdl -I libs/common,libs/types --proto_path third_party/
+```
+
+**特定语言的输出目录(protoc 风格):**
+
+```bash
+# Generate only Java code to a specific directory
+foryc schema.fdl --java_out=./src/main/java
+
+# Generate multiple languages to different directories
+foryc schema.fdl --java_out=./java/gen --python_out=./python/src --cpp_out=./cpp/gen --go_out=./go/gen --rust_out=./rust/gen --csharp_out=./csharp/gen --javascript_out=./javascript/src --swift_out=./swift/gen --dart_out=./dart/gen --scala_out=./scala/gen --kotlin_out=./kotlin/gen
+
+# Combine with import paths
+foryc schema.fdl --java_out=./gen/java -I proto/ -I common/
+
+# Generate Scala 3 code to a specific directory
+foryc schema.fdl --scala_out=./src/main/scala
+
+# Generate Scala 3 models and gRPC service companions
+foryc service.fdl --scala_out=./src/main/scala --grpc
+
+# Generate Kotlin code to a specific directory
+foryc schema.fdl --kotlin_out=./src/main/kotlin
+```
+
+使用 `--{lang}_out` 选项时:
+
+- 仅生成指定语言,而不是所有语言
+- 编译器写入指定目录(特定语言的生成器仍可能创建 package/module 子目录)
+- 与 protoc 风格的工作流兼容
+
+**查看从 proto/fbs 输入转换得到的 Fory IDL:**
+
+```bash
+# Print translated Fory IDL to stdout
+foryc schema.proto --emit-fdl
+
+# Write translated Fory IDL to a directory
+foryc schema.fbs --emit-fdl --emit-fdl-path ./translated
+```
+
+## 导入路径解析
+
+编译包含导入的 Fory IDL 文件时,编译器按以下顺序搜索被导入文件:
+
+1. **相对于发起导入的文件(默认)** - 编译器始终自动优先搜索包含 import 语句的文件所在目录。同目录导入不需要 `-I` 标志。
+2. **依次搜索每个 `-I` 路径** - 命令行中指定的其他搜索路径
+
+**同目录导入会自动生效:**
+
+```protobuf
+// main.fdl
+import "common.fdl"; // Found if common.fdl is in the same directory
+```
+
+```bash
+# No -I needed for same-directory imports
+foryc main.fdl
+```
+
+**项目结构示例:**
+
+```
+project/
+├── src/
+│ └── main.fdl # import "common.fdl";
+└── libs/
+ └── common.fdl
+```
+
+**不使用 `-I`(失败):**
+
+```bash
+$ foryc src/main.fdl
+Import error: Import not found: common.fdl
+ Searched in: /project/src
+```
+
+**使用 `-I`(成功):**
+
+```bash
+$ foryc src/main.fdl -I libs/
+Compiling src/main.fdl...
+ Resolved 1 import(s)
+```
+
+## 支持的语言
+
+| 语言 | 标志 | 输出扩展名 | 说明 |
+| --------------------- | ------------ | ---------- | ----------------------------- |
+| Java | `java` | `.java` | 带 Fory 注解的 POJO |
+| Python | `python` | `.py` | 带类型提示的 dataclass |
+| Go | `go` | `.go` | 带 struct tag 的结构体 |
+| Rust | `rust` | `.rs` | 带派生宏的结构体 |
+| C++ | `cpp` | `.h` | 带 FORY 宏的结构体 |
+| C# | `csharp` | `.cs` | 带 Fory attribute 的类 |
+| JavaScript/TypeScript | `javascript` | `.ts` | 带 Schema 模块辅助函数的接口 |
+| Swift | `swift` | `.swift` | Fory Swift 模型宏 |
+| Dart | `dart` | `.dart` | 带注解的 `@ForyStruct` 类 |
+| Scala | `scala` | `.scala` | 使用宏派生的 Scala 3 模型 |
+| Kotlin | `kotlin` | `.kt` | 带 KSP 序列化器的 Kotlin 模型 |
+
+## 输出结构
+
+### Java
+
+```
+generated/
+└── java/
+ └── com/
+ └── example/
+ ├── User.java
+ ├── Order.java
+ ├── Status.java
+ └── ExampleForyModule.java
+```
+
+- 每个类型(枚举或消息)对应一个文件
+- package 结构与 Fory IDL package 一致
+- 生成 Schema 模块类
+
+### Python
+
+```
+generated/
+└── python/
+ └── example.py
+```
+
+- 所有类型位于单个模块中
+- 模块名派生自 package
+- 包含注册函数
+
+### Go
+
+```
+generated/
+└── go/
+ └── example/
+ └── example.go
+```
+
+- 所有类型位于单个文件中
+- 目录和 package 名派生自 `go_package` 或 Fory IDL package
+- 包含注册函数
+
+### Rust
+
+```
+generated/
+└── rust/
+ └── example.rs
+```
+
+- 所有类型位于单个模块中
+- 模块名派生自 package
+- 包含注册函数
+
+### C++
+
+```
+generated/
+└── cpp/
+ └── example.h
+```
+
+- 单个头文件
+- 命名空间与 package 一致(将点号转换为 `::`)
+- 包含头文件保护和前置声明
+
+### JavaScript/TypeScript
+
+```
+generated/
+└── javascript/
+ ├── example.ts
+ ├── example_grpc.ts # with --grpc
+ └── example_grpc_web.ts # with --grpc-web
+```
+
+- 每个 Schema 对应一个 `.ts` 文件
+- 消息使用 `export interface` 声明
+- 枚举使用 `export enum` 声明
+- 使用 case 枚举的可辨识联合类型
+- 包含 Schema 辅助函数 `registerXxxTypes(fory)`,以及默认的 `serializeX` 和
+ `deserializeX` 辅助函数
+- `--grpc` 输出使用 `@grpc/grpc-js` 的 Node.js 配套代码
+- `--grpc-web` 输出使用 `grpc-web` 的浏览器客户端配套代码
+
+### C\#
+
+```
+generated/
+└── csharp/
+ └── example/
+ └── Example.cs
+```
+
+- 每个 Schema 对应一个 `.cs` 文件,文件名取规范化为 PascalCase 的源文件主名
+- 命名空间使用 `csharp_namespace`(若已设置),否则使用 Fory IDL package
+- 包含以源文件名为前缀的 `XXXForyModule` 安装辅助类以及 `ToBytes`/`FromBytes` 方法
+- 传递式安装导入的 Schema(例如 `root.idl` 导入 `addressbook.fdl` 和 `tree.fdl`)
+- 使用 `--grpc` 时,每个服务会在 Schema 文件输出旁生成一个 `<ServiceName>Grpc.cs` 配套文件
+
+### Swift
+
+```
+generated/
+└── swift/
+ └── addressbook/
+ └── addressbook.swift
+```
+
+- 每个 Schema 对应一个 `.swift` 文件
+- package 各段映射为嵌套 Swift 枚举(例如 `addressbook.*` -> `Addressbook.*`)
+- 生成的消息使用 `@ForyStruct`,枚举使用 `@ForyEnum`,联合类型使用 `@ForyUnion`/`@ForyCase`
+- 联合类型生成为带关联载荷值的标签枚举
+- 每个 Schema 都包含 Schema 文件模块所有者和 `toBytes`/`fromBytes` 辅助函数
+- 生成的模块辅助函数会传递式安装导入的 Schema
+
+### Dart
+
+```
+generated/
+└── dart/
+ └── package/
+ ├── package.dart
+ └── package.fory.dart
+```
+
+- 每个 Schema 生成两个文件:包含注解类型的主 `.dart` 文件,以及包含生成序列化器的 `.fory.dart` part 文件
+- package 各段映射为目录(例如 `demo.foo` → `demo/foo/`)
+- 主文件包含 IDL 模块类,part 文件包含生成的序列化器元数据
+- 非 optional、非 ref 的基本类型列表使用类型化数组(例如 `Int32List`)
+- 使用 `--grpc` 时,每个 Schema 会在模型文件旁生成一个 `<stem>_grpc.dart` 配套文件,
+ 其中包含每个服务的 `Client` 和 `ServiceBase`,并导入 `package:grpc`
+
+### Scala
+
+```
+generated/
+└── scala/
+ └── example/
+ ├── User.scala
+ ├── Status.scala
+ ├── Animal.scala
+ ├── ExampleServiceGrpc.scala
+ └── ExampleForyModule.scala
+```
+
+- 每个生成类型对应一个 Scala 3 源文件
+- package 结构与 Fory IDL package 一致
+- 消息派生 `org.apache.fory.scala.ForySerializer`
+- `optional T` 字段使用 `Option[T]`
+- 枚举使用 Scala 3 `enum`
+- 联合类型使用 Scala 3 ADT `enum`,并带有 `@ForyUnion`、`@ForyCase` 和 `Unknown`
+- 包含 Schema 模块对象
+- 每个本地服务定义在使用 `--grpc` 时生成一个 `<ServiceName>Grpc.scala` 服务配套文件
+
+### Kotlin
+
+```
+generated/
+└── kotlin/
+ └── example/
+ ├── User.kt
+ ├── Status.kt
+ ├── Animal.kt
+ └── ExampleForyModule.kt
+```
+
+- 每个生成类型对应一个 Kotlin 源文件
+- 设置 `kotlin_package` 时使用该 package 结构,否则使用 Fory IDL package
+- 消息使用 `@ForyStruct` 和 KSP 生成的序列化器
+- 枚举使用稳定的 Fory 枚举 ID
+- 联合类型使用带 `@ForyUnion`、`@ForyCase` 和未知 case 载体的密封类
+- 包含 Schema 模块对象
+- 使用 `--grpc` 时,每个服务生成一个 `<ServiceName>GrpcKt.kt` 协程服务配套文件
+
+### C# IDL 矩阵验证
+
+运行端到端 C# IDL 矩阵(FDL/IDL/Proto/FBS 生成及往返测试):
+
+```bash
+cd integration_tests/idl_tests
+./run_csharp_tests.sh
+```
+
+此脚本会对以下内容执行同 Schema 和兼容模式的往返测试:
+
+- `addressbook`、`auto_id`、`complex_pb` 基本类型
+- `collection` 以及 union/list 变体
+- `optional_types`
+- `any_example`(`.fdl`)和 `any_example`(`.proto`)
+- `tree` 和 `graph` 引用跟踪用例
+- `monster.fbs` 和 `complex_fbs.fbs`
+- `root.idl` 跨 package 导入覆盖
+- Schema 演进兼容性用例
+
+### Swift IDL 矩阵验证
+
+运行端到端 Swift IDL 矩阵(FDL/IDL/Proto/FBS 生成及往返测试):
+
+```bash
+cd integration_tests/idl_tests
+./run_swift_tests.sh
+```
+
+该脚本会运行:
+
+- 兼容模式和同 Schema 模式下的本地 Swift IDL 往返测试
+- 使用 `IDL_PEER_LANG=swift` 的 Java 驱动对端往返验证
+
+该脚本还会设置 `DATA_FILE*` 变量,以覆盖基于文件的往返路径。
+
+## 错误处理
+
+### 语法错误
+
+```
+Error: Line 5, Column 12: Expected ';' after field declaration
+```
+
+修复方法:检查指定行是否缺少分号或存在语法问题。
+
+### 类型名称重复
+
+```
+Error: Duplicate type name: User
+```
+
+修复方法:确保文件中的每个枚举和消息都有唯一名称。
+
+### 类型 ID 重复
+
+```
+Error: Duplicate type ID 100: User and Order
+```
+
+修复方法:为每个类型分配唯一的类型 ID。
+
+### 未知类型引用
+
+```
+Error: Unknown type 'Address' in Customer.address
+```
+
+修复方法:使用类型之前先定义它,或检查拼写错误。
+
+服务 RPC 的请求和响应类型使用相同方式验证:例如
+`rpc SayHello (HelloRequest) returns (HelloReply);` 这样的 RPC 必须引用已定义的消息类型,
+否则验证器会在 RPC 所在行报告 `Unknown type '...'` 错误。
+
+### 字段编号重复
+
+```
+Error: Duplicate field number 1 in User: name and id
+```
+
+修复方法:在每个消息中分配唯一的字段编号。
+
+## 最佳实践
+
+### 项目结构
+
+```
+project/
+├── fdl/
+│ ├── common.fdl # Shared types
+│ ├── user.fdl # User domain
+│ └── order.fdl # Order domain
+├── src/
+│ └── generated/ # Generated code (git-ignored)
+└── build.gradle
+```
+
+### 版本控制
+
+- **跟踪**:Fory IDL Schema 文件
+- **忽略**:生成的代码(可重新生成)
+
+添加到 `.gitignore`:
+
+```
+# Generated Fory IDL code
+src/generated/
+generated/
+```
+
+### CI/CD 集成
+
+每次构建时都重新生成:
+
+```yaml
+# GitHub Actions example
+steps:
+ - name: Install Fory IDL Compiler
+ run: pip install ./compiler
+
+ - name: Generate Types
+ run: foryc fdl/*.fdl --output src/generated
+
+ - name: Build
+ run: ./gradlew build
+```
+
+### Schema 演进
+
+修改 Schema 时:
+
+1. **切勿重用字段编号** - 应将其标记为保留
+2. **切勿更改类型 ID** - 它们是二进制格式的一部分
+3. **添加新字段** - 使用新的字段编号
+4. **使用 `optional`** - 保持向后兼容性
+
+```protobuf
+message User [id=100] {
+ string id = 1;
+ string name = 2;
+ // Field 3 was removed, don't reuse
+ optional string email = 4; // New field
+}
+```
+
+## 故障排查
+
+### 找不到命令
+
+```
+foryc: command not found
+```
+
+**解决方法:**确保编译器已安装并位于 PATH 中:
+
+```bash
+pip install -e ./compiler
+# Or add to PATH
+export PATH=$PATH:~/.local/bin
+```
+
+### 权限被拒绝
+
+```
+Permission denied: ./generated
+```
+
+**解决方法:**确保拥有输出目录的写入权限:
+
+```bash
+chmod -R u+w ./generated
+```
+
+### 生成代码中的导入错误
+
+**Java:**确保项目中包含 Fory 依赖:
+
+```xml
+<dependency>
+ <groupId>org.apache.fory</groupId>
+ <artifactId>fory-core</artifactId>
+ <version>${fory.version}</version>
+</dependency>
+```
+
+**Python:**确保已安装 pyfory:
+
+```bash
+pip install pyfory
+```
+
+**Go:**确保 fory 模块可用:
+
+```bash
+go get github.com/apache/fory/go/fory
+```
+
+**Rust:**确保 `Cargo.toml` 中包含 fory crate:
+
+```toml
+[dependencies]
+fory = "x.y.z"
+```
+
+**C++:**确保 Fory 头文件位于 include 路径中。
+
+**Dart:**确保 `pubspec.yaml` 中包含 fory 软件包:
+
+```yaml
+dependencies:
+ fory: ^1.5.0
+```
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/flatbuffers-idl.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/flatbuffers-idl.md
index 91c31c677a..336c5bbbb0 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/flatbuffers-idl.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/flatbuffers-idl.md
@@ -1,6 +1,6 @@
---
title: FlatBuffers IDL 支持
-sidebar_position: 7
+sidebar_position: 6
id: flatbuffers-idl
license: |
Licensed to the Apache Software Foundation (ASF) under one or more
@@ -19,51 +19,54 @@ license: |
limitations under the License.
---
-本页说明 Apache Fory 如何读取 FlatBuffers schema(`.fbs`)并将其转换为 Fory IR 以生成代码。
+本页介绍 Apache Fory 如何读取 FlatBuffers Schema(`.fbs`),并将其转换为 Fory IR 以
+生成代码。
## 本页内容
-- 何时应在 Fory 中使用 FlatBuffers 输入
-- FlatBuffers 到 Fory 的精确映射行为
-- `.fbs` 中支持的 Fory 扩展属性
-- 迁移注意事项与生成代码差异
+- 何时在 Fory 中使用 FlatBuffers 输入
+- FlatBuffers 到 Fory 的确切映射行为
+- `.fbs` 中支持的 Fory 特有属性
+- 采用说明和生成代码差异
## 为什么使用 Apache Fory
-- **生成代码更符合语言习惯**:Fory 会生成各语言常用风格的类/结构体,可直接作为领域对象使用。
-- **Java 性能更优**:在 Fory 的 Java 对象序列化基准中,Fory 通常快于 FlatBuffers。
-- **其他语言性能相近**:序列化性能通常处于同一量级。
-- **实际反序列化链路更高效**:FlatBuffers 默认并不做原生对象反序列化,因此看起来更快;但当业务需要原生对象时,还需额外转换,这一步往往成为主要开销。在这种场景下,Fory 端到端反序列化通常更快。
-- **API 更简单**:Fory 直接操作原生对象,无需反向构建 table 或手动管理 offset。
-- **对象图建模能力更强**:Fory 原生支持共享引用和循环引用。
+- 符合语言习惯的生成代码:Fory 生成可直接用作领域对象的语言原生类/struct。
+- Java 性能:在 Java 对象序列化工作负载中,Fory 基准测试显示 Fory 比 FlatBuffers 更快。
+- 其他语言:序列化性能通常处于相近范围。
+- 实际反序列化:调用方直接从 FlatBuffers 缓冲区读取时,FlatBuffers 可能更快;但需要
+ 原生对象的应用仍需转换,而转换步骤可能主导读取成本。在这些情况下,Fory 端到端
+ 反序列化通常更快。
+- 更简单的 API:Fory 直接使用原生对象,因此无需反向构建 table 或手动管理偏移量。
+- 更好的对象图建模:共享引用和循环引用是 Fory 的一等功能。
## 快速决策指南
-| 场景 | 建议路径 |
-| ----------------------------------------------- | ----------------------- |
-| 已有 `.fbs` schema,想接入 Fory 运行时/代码生成 | 使用 FlatBuffers 输入 |
-| 新建 schema,希望完整使用 Fory 语法能力 | 使用原生 Fory IDL |
-| 运行时必须保持 FlatBuffers 线格式兼容 | 继续使用 FlatBuffers 栈 |
-| 需要 Fory 对象图语义(`ref`、弱引用等) | 使用 Fory |
+| 场景 | 推荐路径 |
+| ---------------------------------------------- | ----------------------- |
+| 已有 `.fbs` Schema,希望使用 Fory API/代码生成 | 使用 FlatBuffers 输入 |
+| 开始新的 Schema 工作,希望完整控制 Fory 语法 | 使用原生 Fory IDL |
+| 需要 FlatBuffers 编码兼容性 | 保留 FlatBuffers 技术栈 |
+| 需要 Fory 对象图语义(`ref`、弱引用等) | 使用 Fory |
## FlatBuffers 到 Fory 的映射
### Schema 级规则
-- `namespace` 映射为 Fory package 命名空间。
-- `include` 映射为 Fory import。
-- `table` 会被翻译为 `evolving=true`。
-- `struct` 会被翻译为 `evolving=false`。
-- `root_type` 会被解析,但 Fory 运行时/代码生成不会使用。
-- `file_identifier` 与 `file_extension` 会被解析,但 Fory 代码生成不会使用。
+- `namespace` 映射到 Fory 包命名空间。
+- `include` 条目映射到 Fory import。
+- `table` 转换为 `evolving=true`。
+- `struct` 转换为 `evolving=false`。
+- `root_type` 会被解析,但 Fory 代码生成会忽略它。
+- `file_identifier` 和 `file_extension` 会被解析,但 Fory 代码生成不会使用它们。
### 字段编号
-FlatBuffers 字段没有显式 field ID。Fory 会按源码声明顺序分配字段号,从 `1` 开始。
+FlatBuffers 字段没有显式字段 ID。Fory 按源代码声明顺序分配字段编号,从 `1` 开始。
### 标量类型映射
-| FlatBuffers | Fory Type |
+| FlatBuffers | Fory 类型 |
| ----------- | --------- |
| `byte` | `int8` |
| `ubyte` | `uint8` |
@@ -78,14 +81,14 @@ FlatBuffers 字段没有显式 field ID。Fory 会按源码声明顺序分配字
| `bool` | `bool` |
| `string` | `string` |
-向量(`[T]`)映射为 Fory 列表类型。
+Vector(`[T]`)映射到 Fory list。
-### 联合类型
+### 联合
-FlatBuffers union 映射为 Fory union。
+FlatBuffers 联合映射到 Fory 联合。
-- case ID 按声明顺序分配,从 `1` 开始。
-- case 名称由类型名转换为 snake_case 字段名。
+- Case ID 按声明顺序分配,从 `1` 开始。
+- Case 名称从类型名称派生,使用 snake_case 字段命名。
**FlatBuffers**
@@ -100,7 +103,7 @@ table Container {
}
```
-**转换后的 Fory 结构**
+**转换后的 Fory 形式**
```protobuf
union Payload {
@@ -113,9 +116,12 @@ message Container {
}
```
-### gRPC Service
+### 服务
-FlatBuffers `rpc_service` 定义会转换为 Fory service。使用 `--grpc` 时,compiler 会为 Java、Python、Go、Rust、C#、Dart、Scala、Kotlin 和 JavaScript 等支持的输出生成 gRPC service companion。JavaScript 浏览器 client 通过 `--grpc-web` 生成。这些 companion 使用 Fory 序列化 request 和 response payload。
+FlatBuffers `rpc_service` 定义会转换为 Fory 服务。使用 `--grpc` 时,编译器会为 Java、
+Python、Go、Rust、C#、Dart、Scala、Kotlin 和 JavaScript 等支持的输出生成 gRPC 服务
+配套代码。JavaScript 浏览器客户端使用 `--grpc-web` 生成。这些配套代码使用 Fory
+序列化请求和响应载荷。
```fbs
rpc_service SearchService {
@@ -128,33 +134,39 @@ rpc_service SearchService {
foryc api.fbs --java_out=./generated/java --python_out=./generated/python --go_out=./generated/go --rust_out=./generated/rust --csharp_out=./generated/csharp --dart_out=./generated/dart --scala_out=./generated/scala --kotlin_out=./generated/kotlin --javascript_out=./generated/javascript --grpc
```
-生成的 service 代码会导入 gRPC API,因此编译或运行这些文件的应用需要提供 grpc-java、grpc-kotlin、Scala grpc-java API、`grpcio`、grpc-go、Rust `tonic` 和 `bytes`、`@grpc/grpc-js`、C# `Grpc.Core.Api` 及 server/client 依赖,或 Dart `package:grpc`。Python companion 默认使用 `grpc.aio`,也可以通过 `--grpc-python-mode=sync` 生成同步模式。Fory package 不会把 gRPC 作为硬依赖。JavaScript 输出配合 `--grpc-web` 可生成导入 `grpc-web` 的浏览器 client。
+生成的服务代码会导入 grpc API,因此应用在编译或运行这些文件时,必须提供 grpc-java、
+grpc-kotlin、Scala grpc-java API、`grpcio`、grpc-go、Rust `tonic` 和 `bytes`、
+`@grpc/grpc-js`、C# `Grpc.Core.Api` 及服务端/客户端依赖,或 Dart `package:grpc`。
+Python 配套代码默认使用 `grpc.aio`,也可通过 `--grpc-python-mode=sync` 生成同步模式。
+Fory 软件包不会将 gRPC 添加为硬依赖项。对 JavaScript 输出使用 `--grpc-web` 可生成导入
+`grpc-web` 的浏览器客户端。
### 默认值与元数据
-- FlatBuffers 默认值会被解析,但不会作为 Fory 运行时默认值生效。
-- 非 Fory 的 metadata 属性会作为通用 option 保留在 IR 中,供下游工具按需消费。
+- FlatBuffers 默认值会被解析,但不会作为 Fory 默认值应用。
+- 非 Fory 元数据属性会作为通用选项保留在 IR 中,并可由下游工具使用。
-## FlatBuffers 中的 Fory 扩展属性
+## FlatBuffers 中的 Fory 特有属性
-FlatBuffers metadata 属性写法为 `key:value`。对于 Fory 扩展选项,在 `.fbs` 中使用 `fory_`(或 `fory.`)前缀;解析时会去掉该前缀。
+FlatBuffers 元数据属性使用 `key:value`。对于 Fory 特有选项,使用 `fory_`
+(或 `fory.`)前缀;解析时会从 `.fbs` 中移除该前缀。
### 支持的字段属性
-| FlatBuffers Attribute | 在 Fory 中的效果 |
-| ------------------------------- | ------------------------------------------------------------------------ |
-| `fory_ref:true` | 为字段启用引用跟踪 |
-| `fory_nullable:true` | 将字段标记为 optional/nullable |
-| `fory_weak_ref:true` | 启用弱引用语义,并隐含开启 `ref` |
-| `fory_thread_safe_pointer:true` | 对 ref 字段使用 Rust `Arc`/`ArcWeak`,而不是默认的 `Rc`/`RcWeak` |
+| FlatBuffers 属性 | 在 Fory 中的效果 |
+| -------------------------------- | ---------------------------------------------------------------- |
+| `fory_ref:true` | 为字段启用引用跟踪 |
+| `fory_nullable:true` | 将字段标记为可选/可空 |
+| `fory_weak_ref:true` | 启用弱引用语义,并隐含 `ref` |
+| `fory_thread_safe_pointer:false` | 对 ref 字段选择 Rust `Rc`/`RcWeak`,而不是默认的 `Arc`/`ArcWeak` |
-语义说明:
+语义:
- `fory_weak_ref:true` 隐含 `ref`。
-- `fory_thread_safe_pointer` 默认为 `false`,仅在字段启用 ref 跟踪时生效,且不会改变编码格式。
-- 在 Rust 代码生成中,`fory_weak_ref:true` 默认使用 `RcWeak`;只有同时设置
- `fory_thread_safe_pointer:true` 时才会切换为 `ArcWeak`。
-- 对列表字段,`fory_ref:true` 作用于列表元素。
+- `fory_thread_safe_pointer` 默认为 `true`,仅在字段跟踪引用时生效,并且不会改变编码格式。
+- 在 Rust 代码生成中,`fory_weak_ref:true` 默认使用 `ArcWeak`,只会切换为
+ `RcWeak`;切换条件是设置 `fory_thread_safe_pointer:false`。
+- 对于 list 字段,`fory_ref:true` 应用于 list 元素。
示例:
@@ -162,41 +174,45 @@ FlatBuffers metadata 属性写法为 `key:value`。对于 Fory 扩展选项,
table Node {
parent: Node (fory_weak_ref: true);
children: [Node] (fory_ref: true);
- cached: Node (fory_ref: true, fory_thread_safe_pointer: true);
+ local: Node (fory_ref: true, fory_thread_safe_pointer: false);
}
```
## 生成代码差异
-即使用 `.fbs` 作为 Fory 输入,生成的依然是标准 Fory 代码,而不是 FlatBuffers 的 `ByteBuffer` 风格 API。
+将 `.fbs` 用作 Fory 输入时,仍会生成常规 Fory 代码,而不是 FlatBuffers `ByteBuffer`
+风格的 API。
-- Java:带 Fory 元数据的 POJO/record
-- Python:dataclass 与注册辅助代码
-- Go/Rust/C++:原生结构体与 Fory 元数据
+- Java、Scala 和 Kotlin:带 Fory 元数据和注册辅助方法的 JVM 模型类型
+- Python:dataclass 加注册辅助方法
+- C++、Go 和 Rust:原生 struct 和 Fory 元数据
+- JavaScript/TypeScript:TypeScript 接口和 Schema 辅助方法
+- C#、Swift 和 Dart:带注册辅助方法的注解或基于宏的模型类型
-最终序列化格式是 Fory 二进制协议,而不是 FlatBuffers 线格式。
+序列化格式是 Fory 二进制协议,而不是 FlatBuffers 编码格式。
-## 用法
+## 使用方式
-直接编译 FlatBuffers schema:
+直接编译 FlatBuffers Schema:
```bash
foryc schema.fbs --lang java,python --output ./generated
```
-输出转换后的 Fory schema 语法以便调试:
+检查转换后的 Schema 语法以进行调试:
```bash
foryc schema.fbs --emit-fdl --emit-fdl-path ./translated
```
-## 迁移注意事项
+## 采用说明
-1. 保持现有 `namespace` 稳定,以保证类型注册稳定。
-2. 检查依赖 FlatBuffers 字面量默认值的字段,并在业务代码中补充显式默认值。
-3. 在需要对象图语义的字段上添加 `fory_ref`/`fory_weak_ref`。
-4. 替换现有序列化路径前,先用 roundtrip 测试验证生成模型行为。
+1. 保持现有 `namespace` 值稳定,以保持类型注册稳定。
+2. 检查依赖 FlatBuffers 默认字面量的字段,并根据需要在应用代码中设置显式默认值。
+3. 在需要对象图语义的位置添加 `fory_ref`/`fory_weak_ref`。
+4. 替换现有序列化路径之前,使用往返测试验证生成模型的行为。
## 总结
-FlatBuffers 输入模式可让你复用现有 `.fbs` schema,同时迁移到 Fory 运行时与代码生成模型。它适合渐进式迁移场景:既保留既有 schema 投入,又能采用 Fory 原生对象 API。
+FlatBuffers 输入允许在迁移到 Fory 序列化和代码生成模型时复用现有 `.fbs` Schema。这有助于
+在保留 Schema 投入并使用 Fory 原生对象 API 的同时逐步采用 Fory。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/_category_.json b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/_category_.json
new file mode 100644
index 0000000000..67ef51834f
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/_category_.json
@@ -0,0 +1,6 @@
+{
+ "position": 8,
+ "label": "生成的代码",
+ "collapsible": true,
+ "collapsed": true
+}
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/cpp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/cpp.md
new file mode 100644
index 0000000000..1e3df5573e
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/cpp.md
@@ -0,0 +1,157 @@
+---
+title: C++
+sidebar_position: 5
+id: cpp
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## 输出布局
+
+C++ 输出为每个 Schema 文件生成一个头文件,例如:
+
+- `<cpp_out>/addressbook.h`
+
+## 类型生成
+
+消息生成带类型化访问器和字节辅助方法的 `final` 类:
+
+```cpp
+class Person final {
+ public:
+ class PhoneNumber final {
+ public:
+ const std::string& number() const;
+ std::string* mutable_number();
+ template <class Arg, class... Args>
+ void set_number(Arg&& arg, Args&&... args);
+
+ fory::Result<std::vector<uint8_t>, fory::Error> to_bytes() const;
+ static fory::Result<PhoneNumber, fory::Error> from_bytes(
+ const uint8_t* data, std::size_t size);
+ static fory::Result<PhoneNumber, fory::Error> from_bytes(const std::vector<uint8_t>& data);
+ };
+
+ const std::string& name() const;
+ std::string* mutable_name();
+ template <class Arg, class... Args>
+ void set_name(Arg&& arg, Args&&... args);
+
+ const Animal& pet() const;
+ Animal* mutable_pet();
+};
+```
+
+可选消息字段生成 `has_xxx`、`mutable_xxx` 和 `clear_xxx` API:
+
+```cpp
+class Envelope final {
+ public:
+ bool has_payload() const { return payload_ != nullptr; }
+ const Envelope::Payload& payload() const { return *payload_; }
+ Envelope::Payload* mutable_payload() {
+ if (!payload_) {
+ payload_ = std::make_unique<Envelope::Payload>();
+ }
+ return payload_.get();
+ }
+ void clear_payload() { payload_.reset(); }
+
+ private:
+ std::unique_ptr<Envelope::Payload> payload_;
+};
+```
+
+联合生成 `std::variant` 包装器:
+
+```cpp
+class Animal final {
+ public:
+ enum class AnimalCase : uint32_t {
+ DOG = 1,
+ CAT = 2,
+ };
+
+ static Animal dog(Dog v);
+ static Animal cat(Cat v);
+
+ AnimalCase animal_case() const noexcept;
+ uint32_t animal_case_id() const noexcept;
+
+ bool is_dog() const noexcept;
+ const Dog* as_dog() const noexcept;
+ Dog* as_dog() noexcept;
+ const Dog& dog() const;
+ Dog& dog();
+
+ template <class Visitor>
+ decltype(auto) visit(Visitor&& vis) const;
+
+ private:
+ std::variant<Dog, Cat> value_;
+};
+```
+
+生成的头文件包含用于序列化元数据的 `FORY_UNION`、`FORY_ENUM` 和 `FORY_STRUCT` 宏。
+字段和载荷配置嵌入生成的 `FORY_STRUCT`/`FORY_UNION` 条目中。
+
+## 注册
+
+生成的注册函数:
+
+```cpp
+inline void register_types(fory::serialization::BaseFory& fory) {
+ fory.register_union<Animal>(106);
+ fory.register_enum<Person::PhoneType>(101);
+ fory.register_struct<Person::PhoneNumber>(102);
+ fory.register_struct<Person>(100);
+ fory.register_struct<Dog>(104);
+ fory.register_struct<Cat>(105);
+ fory.register_struct<AddressBook>(103);
+}
+```
+
+对于没有显式 `[id=...]` 的 Schema,生成的注册代码使用计算得到的数字 ID:
+
+```cpp
+fory.register_enum<Status>(1124725126);
+fory.register_union<Wrapper>(1471345060);
+fory.register_struct<Envelope>(3022445236);
+fory.register_union<Envelope::Detail>(1609214087);
+fory.register_struct<Envelope::Payload>(2862577837);
+```
+
+如果设置了 `option enable_auto_type_id = false;`:
+
+```cpp
+fory.register_struct<Config>("myapp.models.Config");
+fory.register_union<Holder>("myapp.models.Holder");
+```
+
+## 使用方式
+
+```cpp
+addressbook::Person person;
+person.set_name("Alice");
+*person.mutable_pet() = addressbook::Animal::dog(addressbook::Dog{});
+
+auto bytes = person.to_bytes();
+auto restored = addressbook::Person::from_bytes(bytes.value());
+```
+
+## gRPC 服务配套代码
+
+使用 `--grpc` 时,C++ 会生成 `<stem>.service.h`、`<stem>.service.grpc.h` 和 `<stem>.service.grpc.cc`。API 头文件在 `::<namespace>::service` 下包含同步接口和路由常量;绑定头文件包含生成的 `grpc::SerializationTraits` 以及位于 `::<namespace>::service::grpc` 下的客户端和服务端包装器。构建和使用指南请参阅 [C++ gRPC](../../grpc/cpp.md)。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/csharp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/csharp.md
new file mode 100644
index 0000000000..6a80683fc3
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/csharp.md
@@ -0,0 +1,103 @@
+---
+title: C#
+sidebar_position: 7
+id: csharp
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## 输出布局
+
+C# 输出为每个 Schema 生成一个 `.cs` 文件,例如:
+
+- `<csharp_out>/addressbook/Addressbook.cs`
+
+C# 模型文件名使用规范化的 PascalCase 源文件主名(stem)。例如,`service.fdl` 生成
+`Service.cs`,`order-events.fdl` 生成 `OrderEvents.cs`,`123-schema.fdl` 生成
+`Schema123Schema.cs`。
+
+## 类型生成
+
+消息生成带 C# 属性和字节辅助方法的 `[ForyStruct]` 类:
+
+```csharp
+[ForyStruct]
+public sealed partial class Person
+{
+ public string Name { get; set; } = string.Empty;
+ public int Id { get; set; }
+ public List<Person.PhoneNumber> Phones { get; set; } = new();
+ public Animal Pet { get; set; } = null!;
+
+ public byte[] ToBytes() { ... }
+ public static Person FromBytes(byte[] data) { ... }
+}
+```
+
+联合生成 `[ForyUnion]` ADT。`Unknown(UnknownCase)` 是 Fory 提供的向前兼容载体,使用
+`[ForyUnknownCase]` 标记。该标记只选择载体,不会向 Schema case 表添加条目。Schema
+定义的 case 使用非负 `[ForyCase]` ID。如果 case 需要非默认 Schema 编码,生成的
+`[ForyCase]` 会携带 `Type`。已知 case record 名称采用 PascalCase FDL case 名称;需要
+避免名称冲突时,载荷类型生成为限定引用。类型化联合必须至少包含一个非 `Unknown` case。
+
+```csharp
+[ForyUnion]
+public abstract partial record Animal
+{
+ private Animal() {}
+
+ [ForyUnknownCase]
+ public sealed partial record Unknown(UnknownCase Value) : Animal;
+
+ [ForyCase(0)]
+ public sealed partial record Dog(global::addressbook.Dog Value) : Animal;
+
+ [ForyCase(1)]
+ public sealed partial record Cat(global::addressbook.Cat Value) : Animal;
+}
+```
+
+## 模块安装
+
+每个 Schema 都会生成一个模块类,该类先安装导入的模块,再注册本地 Schema 类型:
+
+```csharp
+public static class AddressbookForyModule
+{
+ public static void Install(Fory fory)
+ {
+ fory.Register<addressbook.Animal>((uint)106);
+ fory.Register<addressbook.Person>((uint)100);
+ // ...
+ }
+}
+```
+
+C# 模型文件的基础文件名和模块类都使用规范化的源文件主名。它们不使用
+`csharp_namespace`,也不使用 gRPC 服务名称。例如,`service.fdl` 生成 `Service.cs` 和
+`ServiceForyModule`,而 `order-events.fdl` 生成 `OrderEvents.cs` 和
+`OrderEventsForyModule`。名为 `Greeter` 的 gRPC 服务生成服务配套文件 `GreeterGrpc.cs`;
+它不会更改 Schema 模块名称。要获得 `GreeterForyModule`,请将 Schema 文件命名为
+`greeter.fdl` 或 `Greeter.fdl`。
+
+此源文件规则允许多个 Schema 指向同一个 C# 命名空间而不发生冲突。不会生成从命名空间
+或服务派生的模块别名。
+
+未提供显式类型 ID 时,生成的安装代码使用计算得到的数字 ID(与其他目标行为相同)。
+
+## gRPC 服务配套代码
+
+使用 `--grpc` 时,C# 为每个服务生成一个 `<ServiceName>Grpc.cs`。其静态服务持有者包含描述符、`<ServiceName>Base`、`<ServiceName>Client` 和两个 `BindService` 重载。托管、客户端、依赖项和流式处理请参阅 [C# gRPC](../../grpc/csharp.md)。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/dart.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/dart.md
new file mode 100644
index 0000000000..7c58d6547d
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/dart.md
@@ -0,0 +1,190 @@
+---
+title: Dart
+sidebar_position: 10
+id: dart
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## 输出布局
+
+Dart 为每个 Schema 输出两个文件:包含注解类型和 IDL 模块所有者的主 `.dart` 文件,以及包含生成序列化器和元数据的 `.fory.dart` part 文件。
+
+- `<dart_out>/package/package.dart`
+- `<dart_out>/package/package.fory.dart`
+
+## 类型生成
+
+消息生成带 `@ForyStruct` 注解的 `final class` 声明,每个字段都带有 `@ForyField`:
+
+```dart
+@ForyStruct()
+final class Person {
+ Person();
+
+ @ForyField(id: 1)
+ String name = '';
+
+ @ForyField(id: 2, type: Int32Type())
+ int id = 0;
+
+ @ForyField(id: 7)
+ List<Person_PhoneNumber> phones = <Person_PhoneNumber>[];
+
+ @ForyField(id: 8)
+ Animal pet = Animal._empty();
+}
+```
+
+枚举生成 Dart `enum` 声明,并提供 `rawValue` getter 和 `fromRawValue` 工厂:
+
+```dart
+enum Person_PhoneType {
+ mobile,
+ home,
+ work;
+
+ int get rawValue => switch (this) {
+ Person_PhoneType.mobile => 0,
+ Person_PhoneType.home => 1,
+ Person_PhoneType.work => 2,
+ };
+
+ static Person_PhoneType fromRawValue(int value) => switch (value) {
+ 0 => Person_PhoneType.mobile,
+ 1 => Person_PhoneType.home,
+ 2 => Person_PhoneType.work,
+ _ => throw StateError('Unknown Person_PhoneType raw value $value.'),
+ };
+}
+```
+
+联合生成带 `@ForyUnion` 注解的类,其中包含工厂构造函数、case 枚举和自定义序列化器:
+
+```dart
+enum AnimalCase {
+ dog,
+ cat;
+
+ int get id => switch (this) {
+ AnimalCase.dog => 1,
+ AnimalCase.cat => 2,
+ };
+}
+
+@ForyUnion()
+final class Animal {
+ final AnimalCase _case;
+ final Object? _value;
+
+ const Animal._(this._case, this._value);
+
+ factory Animal.dog(Dog value) => Animal._(AnimalCase.dog, value);
+ factory Animal.cat(Cat value) => Animal._(AnimalCase.cat, value);
+
+ bool get isDog => _case == AnimalCase.dog;
+ Dog get dogValue => _value as Dog;
+ // ...
+}
+```
+
+嵌套类型使用扁平下划线命名(例如 `Person_PhoneNumber`、`Person_PhoneType`)。
+
+`list<T>` 字段生成有序集合载体并使用 Fory list 协议。`array<T>` 字段生成一维稠密 bool
+或数值载体,并使用专用稠密数组协议。生成的代码不得仅仅因为某种语言具有优化的类 list
+载体就选择 `array<T>`;Schema 种类来自 IDL。
+
+| IDL Schema | Dart 生成的载体 | 说明 |
+| ------------------- | --------------- | -------------------------- |
+| `list<int32>` | `List<int>` | List 协议,varint 元素编码 |
+| `list<fixed int32>` | `List<int>` | List 协议,固定宽度元素段 |
+| `array<bool>` | `BoolList` | 每个 bool 一个字节 |
+| `array<int8>` | `Int8List` | 稠密有符号字节 |
+| `array<int16>` | `Int16List` | 稠密小端 int16 |
+| `array<int32>` | `Int32List` | 稠密小端 int32 |
+| `array<int64>` | `Int64List` | 稠密小端 int64 |
+| `array<uint8>` | `Uint8List` | 稠密无符号字节 |
+| `array<uint16>` | `Uint16List` | 稠密小端 uint16 |
+| `array<uint32>` | `Uint32List` | 稠密小端 uint32 |
+| `array<uint64>` | `Uint64List` | 稠密小端 uint64 |
+| `array<float16>` | `Float16List` | 稠密 binary16 存储 |
+| `array<bfloat16>` | `Bfloat16List` | 稠密 bfloat16 存储 |
+| `array<float32>` | `Float32List` | 稠密小端 float32 |
+| `array<float64>` | `Float64List` | 稠密小端 float64 |
+
+使用 `ArrayType(element: BoolType())` 的生成 Dart 字段必须使用 `BoolList`;普通
+`List<bool>` 仍是 `list<bool>` 的生成和手写载体。
+
+list 元素或 map 值的引用跟踪使用容器语法糖注解:
+
+```dart
+@ListField(element: DeclaredType(ref: true))
+@ForyField(id: 3)
+List<Node> children = <Node>[];
+
+@MapField(value: DeclaredType(ref: true))
+@ForyField(id: 2)
+Map<String, Node> byName = <String, Node>{};
+```
+
+## 模块安装
+
+每个生成的 Dart IDL 库都包含根据输入文件命名的模块所有者,例如 `AddressbookForyModule`
+对应 `addressbook.dart`。该模块先安装导入的模块,再使用默认 IDL 身份注册每个本地
+Schema 类型:
+
+```dart
+abstract final class AddressbookForyModule {
+ static void install(Fory fory) {
+ complex_pb.ComplexPbForyModule.install(fory);
+ _registerType(fory, Person);
+ _registerType(fory, Dog);
+ }
+
+ static Fory getFory() { ... }
+
+ static void _registerType(Fory fory, Type type) {
+ if (type == Person) {
+ registerGeneratedStruct(fory, _personForySchema, id: 100, namespace: null, typeName: null);
+ return;
+ }
+ // ... other types
+ }
+}
+```
+
+## 使用方式
+
+```dart
+import 'package:fory/fory.dart';
+import 'generated/addressbook/addressbook.dart';
+
+void main() {
+ final fory = Fory();
+ AddressbookForyModule.install(fory);
+
+ final person = Person()
+ ..name = 'Alice'
+ ..id = 1;
+
+ final bytes = fory.serialize(person);
+ final roundTrip = fory.deserialize<Person>(bytes);
+}
+```
+
+## gRPC 服务配套代码
+
+使用 `--grpc` 时,Dart 为每个 Schema 生成一个 `<stem>_grpc.dart`,其中包含 `<Service>Client` 和 `<Service>ServiceBase`。服务基类会注册自己的方法描述符,因此不会生成单独的 registrar。生成模块命名、Fory 安装和使用方式请参阅 [Dart gRPC](../../grpc/dart.md)。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/go.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/go.md
new file mode 100644
index 0000000000..dab08a9855
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/go.md
@@ -0,0 +1,148 @@
+---
+title: Go
+sidebar_position: 6
+id: go
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## 输出布局
+
+Go 输出路径取决于 Schema 选项和 `--go_out`。
+
+对于 `addressbook.fdl`,配置 `go_package` 后,生成的输出遵循所配置的导入路径/包(例如位于 `--go_out` 根目录下)。
+
+如果没有 `go_package`,输出使用请求的 `--go_out` 目录和从包派生的文件命名。
+
+## 类型生成
+
+嵌套类型默认使用下划线命名(`Person_PhoneType`、`Person_PhoneNumber`):
+
+```go
+type Person_PhoneType int32
+
+const (
+ Person_PhoneTypeMobile Person_PhoneType = 0
+ Person_PhoneTypeHome Person_PhoneType = 1
+ Person_PhoneTypeWork Person_PhoneType = 2
+)
+
+type Person_PhoneNumber struct {
+ Number string `fory:"id=1"`
+ PhoneType Person_PhoneType `fory:"id=2"`
+}
+```
+
+消息生成带 `fory` tag 和字节辅助方法的 struct:
+
+```go
+type Person struct {
+ Name string `fory:"id=1"`
+ Id int32 `fory:"id=2"`
+ Phones []Person_PhoneNumber `fory:"id=7,type=list"`
+ Pet Animal `fory:"id=8"`
+}
+
+func (m *Person) ToBytes() ([]byte, error) { ... }
+func (m *Person) FromBytes(data []byte) error { ... }
+```
+
+联合生成带构造函数、访问器和 visitor API 的类型化 case struct:
+
+```go
+type AnimalCase uint32
+
+type Animal struct {
+ case_ AnimalCase
+ value any
+}
+
+func DogAnimal(v *Dog) Animal { ... }
+func CatAnimal(v *Cat) Animal { ... }
+
+func (u Animal) Case() AnimalCase { ... }
+func (u Animal) AsDog() (*Dog, bool) { ... }
+func (u Animal) Visit(visitor AnimalVisitor) error { ... }
+```
+
+## 注册
+
+生成的注册函数:
+
+```go
+func RegisterTypes(f *fory.Fory) error {
+ if err := f.RegisterUnion(Animal{}, 106, fory.NewUnionSerializer(...)); err != nil {
+ return err
+ }
+ if err := f.RegisterEnum(Person_PhoneType(0), 101); err != nil {
+ return err
+ }
+ if err := f.RegisterStruct(Person_PhoneNumber{}, 102); err != nil {
+ return err
+ }
+ if err := f.RegisterStruct(Person{}, 100); err != nil {
+ return err
+ }
+ return nil
+}
+```
+
+对于没有显式 `[id=...]` 的 Schema,生成的注册代码使用计算得到的数字 ID:
+
+```go
+if err := f.RegisterEnum(Status(0), 1124725126); err != nil { ... }
+if err := f.RegisterUnion(Wrapper{}, 1471345060, fory.NewUnionSerializer(...)); err != nil { ... }
+if err := f.RegisterStruct(Envelope{}, 3022445236); err != nil { ... }
+if err := f.RegisterUnion(Envelope_Detail{}, 1609214087, fory.NewUnionSerializer(...)); err != nil { ... }
+if err := f.RegisterStruct(Envelope_Payload{}, 2862577837); err != nil { ... }
+```
+
+如果设置了 `option enable_auto_type_id = false;`:
+
+```go
+if err := f.RegisterStructByName(Config{}, "myapp.models.Config"); err != nil { ... }
+if err := f.RegisterUnionByName(Holder{}, "myapp.models.Holder", fory.NewUnionSerializer(...)); err != nil { ... }
+```
+
+`go_nested_type_style` 控制嵌套类型命名:
+
+```protobuf
+option go_nested_type_style = "camelcase";
+```
+
+两者都设置时,CLI flag `--go_nested_type_style` 会覆盖此 Schema 选项。
+
+## 使用方式
+
+```go
+person := &Person{
+ Name: "Alice",
+ Pet: DogAnimal(&Dog{Name: "Rex"}),
+}
+
+data, err := person.ToBytes()
+if err != nil {
+ panic(err)
+}
+var restored Person
+if err := restored.FromBytes(data); err != nil {
+ panic(err)
+}
+```
+
+## gRPC 服务配套代码
+
+使用 `--grpc` 时,Go 生成 `<module>_grpc.go`,其中包含生成的 `CodecV2`、客户端和服务端接口、流类型、描述符及注册辅助方法。codec 配置和使用方式请参阅 [Go gRPC](../../grpc/go.md)。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/index.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/index.md
new file mode 100644
index 0000000000..5dd28a10f3
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/index.md
@@ -0,0 +1,175 @@
+---
+title: 生成的代码
+sidebar_position: 1
+id: index
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+本文档介绍各目标语言生成的代码。
+
+Fory IDL 生成的类型遵循宿主语言习惯,可以直接用作领域对象。根据目标语言,生成的类型还包含 `to/from bytes` 辅助方法以及 Schema 模块或注册辅助方法。
+
+生成的 Schema 模块根据 Schema 源文件命名,而不是根据包或命名空间命名。对于在语言
+包或命名空间中直接公开模块的目标,`AddressbookForyModule` 或
+`ComplexPbForyModule` 等名称允许多个 IDL 文件指向同一个包或命名空间,而不会生成
+冲突的 `ForyModule` 类型。
+
+## 参考 Schema
+
+以下示例使用两个真实 Schema:
+
+1. `addressbook.fdl`(显式类型 ID)
+2. `auto_id.fdl`(无显式类型 ID)
+
+### `addressbook.fdl` 摘录
+
+```protobuf
+package addressbook;
+
+option go_package = "github.com/myorg/myrepo/gen/addressbook;addressbook";
+
+message Person [id=100] {
+ string name = 1;
+ int32 id = 2;
+
+ enum PhoneType [id=101] {
+ PHONE_TYPE_MOBILE = 0;
+ PHONE_TYPE_HOME = 1;
+ PHONE_TYPE_WORK = 2;
+ }
+
+ message PhoneNumber [id=102] {
+ string number = 1;
+ PhoneType phone_type = 2;
+ }
+
+ list<PhoneNumber> phones = 7;
+ Animal pet = 8;
+}
+
+message Dog [id=104] {
+ string name = 1;
+ int32 bark_volume = 2;
+}
+
+message Cat [id=105] {
+ string name = 1;
+ int32 lives = 2;
+}
+
+union Animal [id=106] {
+ Dog dog = 1;
+ Cat cat = 2;
+}
+
+message AddressBook [id=103] {
+ list<Person> people = 1;
+ map<string, Person> people_by_name = 2;
+}
+```
+
+### `auto_id.fdl` 摘录
+
+```protobuf
+package auto_id;
+
+enum Status {
+ UNKNOWN = 0;
+ OK = 1;
+}
+
+message Envelope {
+ string id = 1;
+
+ message Payload {
+ int32 value = 1;
+ }
+
+ union Detail {
+ Payload payload = 1;
+ string note = 2;
+ }
+
+ Payload payload = 2;
+ Detail detail = 3;
+ Status status = 4;
+}
+
+union Wrapper {
+ Envelope envelope = 1;
+ string raw = 2;
+}
+```
+
+## 跨语言说明
+
+### 类型 ID 行为
+
+- 生成的模块安装或注册辅助方法直接使用显式 `[id=...]` 值。
+- 省略类型 ID 时,生成的代码使用计算得到的数字 ID(参见 `auto_id.*` 输出)。
+- 如果设置了 `option enable_auto_type_id = false;`,生成的模块安装或注册辅助方法会使用基于名称的 API,而不是数字 ID。
+
+### 嵌套类型形式
+
+| 语言 | 嵌套类型形式 |
+| --------------------- | ---------------------------- |
+| Java | `Person.PhoneNumber` |
+| Python | `Person.PhoneNumber` |
+| Rust | `person::PhoneNumber` |
+| C++ | `Person::PhoneNumber` |
+| Go | `Person_PhoneNumber`(默认) |
+| C# | `Person.PhoneNumber` |
+| JavaScript/TypeScript | `Person.PhoneNumber` |
+| Swift | `Person.PhoneNumber` |
+| Dart | `Person_PhoneNumber` |
+| Kotlin | `PersonPhoneNumber` |
+| Scala | `Person.PhoneNumber` |
+
+### 字节辅助方法命名
+
+| 语言 | 辅助方法 |
+| --------------------- | --------------------------- |
+| Java | `toBytes` / `fromBytes` |
+| Kotlin | `toBytes` / `fromBytes` |
+| Scala | `toBytes` / `fromBytes` |
+| Python | `to_bytes` / `from_bytes` |
+| Rust | `to_bytes` / `from_bytes` |
+| C++ | `to_bytes` / `from_bytes` |
+| Go | `ToBytes` / `FromBytes` |
+| C# | `ToBytes` / `FromBytes` |
+| JavaScript/TypeScript | (通过 `fory.serialize()`) |
+| Swift | `toBytes` / `fromBytes` |
+| Dart | (通过 `fory.serialize()`) |
+
+## 运行时参考
+
+请选择输出运行时对应的生成代码参考。生成的模型仍是运行时拥有的普通类型,并使用该运行时
+支持的 Fory 序列化 API。
+
+| 运行时 | 生成代码参考 |
+| --------------------- | -------------------------------------- |
+| Java | [Java](java.md) |
+| Python | [Python](python.md) |
+| C++ | [C++](cpp.md) |
+| Go | [Go](go.md) |
+| Rust | [Rust](rust.md) |
+| JavaScript/TypeScript | [JavaScript/TypeScript](javascript.md) |
+| C# | [C#](csharp.md) |
+| Swift | [Swift](swift.md) |
+| Dart | [Dart](dart.md) |
+| Scala | [Scala](scala.md) |
+| Kotlin | [Kotlin](kotlin.md) |
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/java.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/java.md
new file mode 100644
index 0000000000..df05824ae3
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/java.md
@@ -0,0 +1,149 @@
+---
+title: Java
+sidebar_position: 2
+id: java
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## 输出布局
+
+对于 `package addressbook`,Java 输出生成在:
+
+- `<java_out>/addressbook/`
+- 类型文件:`AddressBook.java`、`Person.java`、`Dog.java`、`Cat.java`、`Animal.java`
+- Schema 模块:`AddressbookForyModule.java`
+
+对于没有 Java 包的 Schema,Schema 模块名称从源文件主名(stem)派生,例如 `main.fdl`
+生成 `MainForyModule.java`。Java 导入图不能混用默认包 Schema 和命名 Java 包。
+
+## 类型生成
+
+消息生成带 `@ForyField`、默认构造函数、getter/setter 和字节辅助方法的 Java 类:
+
+```java
+public class Person {
+ public static enum PhoneType {
+ MOBILE,
+ HOME,
+ WORK;
+ }
+
+ public static class PhoneNumber {
+ @ForyField(id = 1)
+ private String number;
+
+ @ForyField(id = 2)
+ private PhoneType phoneType;
+
+ public byte[] toBytes() { ... }
+ public static PhoneNumber fromBytes(byte[] bytes) { ... }
+ }
+
+ @ForyField(id = 1)
+ private String name;
+
+ @ForyField(id = 8)
+ private Animal pet;
+
+ public byte[] toBytes() { ... }
+ public static Person fromBytes(byte[] bytes) { ... }
+}
+```
+
+带 `evolving=false` 的消息使用 Java 固定 Schema struct 编码生成。
+
+联合生成扩展 `org.apache.fory.type.union.Union` 的类:
+
+```java
+public final class Animal extends Union {
+ public enum AnimalCase {
+ DOG(1),
+ CAT(2);
+ public final int id;
+ AnimalCase(int id) { this.id = id; }
+ }
+
+ public static Animal ofDog(Dog v) { ... }
+ public AnimalCase getAnimalCase() { ... }
+ public int getAnimalCaseId() { ... }
+
+ public boolean hasDog() { ... }
+ public Dog getDog() { ... }
+ public void setDog(Dog v) { ... }
+}
+```
+
+## Schema 模块
+
+每个 JVM Schema 都会生成一个 `ForyModule`。导入的 Schema 模块通过
+`fory.register(...)` 安装,因此共享导入由 Fory 实例去重。
+
+```java
+public final class AddressbookForyModule implements org.apache.fory.ForyModule {
+ public static final AddressbookForyModule INSTANCE = new AddressbookForyModule();
+
+ static ThreadSafeFory getFory() { ... }
+
+ @Override
+ public void install(Fory fory) {
+ org.apache.fory.resolver.TypeResolver resolver = fory.getTypeResolver();
+ resolver.registerUnion(Animal.class, 106L, new org.apache.fory.serializer.UnionSerializer(resolver, Animal.class));
+ resolver.register(Person.class, 100L);
+ resolver.register(Person.PhoneType.class, 101L);
+ resolver.register(Person.PhoneNumber.class, 102L);
+ resolver.register(Dog.class, 104L);
+ resolver.register(Cat.class, 105L);
+ resolver.register(AddressBook.class, 103L);
+ }
+}
+```
+
+对于没有显式 `[id=...]` 的 Schema,生成的注册代码使用计算得到的数字 ID(例如来自 `auto_id.fdl`):
+
+```java
+resolver.register(Status.class, 1124725126L);
+resolver.registerUnion(Wrapper.class, 1471345060L, new org.apache.fory.serializer.UnionSerializer(resolver, Wrapper.class));
+resolver.register(Envelope.class, 3022445236L);
+resolver.registerUnion(Envelope.Detail.class, 1609214087L, new org.apache.fory.serializer.UnionSerializer(resolver, Envelope.Detail.class));
+resolver.register(Envelope.Payload.class, 2862577837L);
+```
+
+如果设置了 `option enable_auto_type_id = false;`,注册使用符号名称:
+
+```java
+resolver.register(Config.class, "myapp.models", "Config");
+resolver.registerUnion(
+ Holder.class,
+ "myapp.models",
+ "Holder",
+ new org.apache.fory.serializer.UnionSerializer(resolver, Holder.class));
+```
+
+## 使用方式
+
+```java
+Person person = new Person();
+person.setName("Alice");
+person.setPet(Animal.ofDog(new Dog()));
+
+byte[] data = person.toBytes();
+Person restored = Person.fromBytes(data);
+```
+
+## gRPC 服务配套代码
+
+使用 `--grpc` 时,Java 为每个服务生成一个 `<ServiceName>Grpc.java`。它公开 `SERVICE_NAME`、服务和方法描述符、`<ServiceName>ImplBase`,以及异步、阻塞和 future stub 工厂。依赖项以及服务端、客户端和流式用法请参阅 [Java gRPC](../../grpc/java.md)。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/javascript.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/javascript.md
new file mode 100644
index 0000000000..3bc6e6520b
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/javascript.md
@@ -0,0 +1,93 @@
+---
+title: JavaScript/TypeScript
+sidebar_position: 8
+id: javascript
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## 输出布局
+
+JavaScript/TypeScript 输出为每个 Schema 生成一个 `.ts` 文件,例如:
+
+- `<javascript_out>/addressbook.ts`
+
+当 Schema 包含服务时,JavaScript 还可以生成服务配套代码:
+
+- `<javascript_out>/addressbook_grpc.ts`(使用 `--grpc` 生成)
+- `<javascript_out>/addressbook_grpc_web.ts`(使用 `--grpc-web` 生成)
+
+## 类型生成
+
+消息生成字段名称为 camelCase 的 `export interface` 声明:
+
+```typescript
+export interface Person {
+ name: string;
+ id: number;
+ phones: PhoneNumber[];
+ pet?: Animal | null;
+}
+```
+
+枚举生成 `export enum` 声明:
+
+```typescript
+export enum PhoneType {
+ MOBILE = 0,
+ HOME = 1,
+ WORK = 2,
+}
+```
+
+联合生成带 case 枚举的可辨识联合:
+
+```typescript
+export enum AnimalCase {
+ DOG = 1,
+ CAT = 2,
+}
+
+export type Animal =
+ { case: AnimalCase.DOG; value: Dog } | { case: AnimalCase.CAT; value: Cat };
+```
+
+## Schema 辅助方法
+
+每个生成的模型文件都会导出用于自定义 `Fory` 实例的注册辅助方法和根序列化辅助方法。
+公共 API 如下:
+
+```typescript
+import type Fory, { Serializer } from "@apache-fory/core";
+
+export function registerAddressbookTypes(fory: Fory): {
+ person: {
+ serialize: (value: Person | null) => Uint8Array;
+ deserialize: (bytes: Uint8Array) => Person;
+ serializer: Serializer;
+ };
+};
+export const serializePerson: (value: Person | null) => Uint8Array;
+export const deserializePerson: (bytes: Uint8Array) => Person;
+```
+
+导入的 Schema 模块由 `registerXxxTypes(fory)` 自动注册。生成的默认序列化路径请使用
+`serializeX` 和 `deserializeX`。当应用自行管理实例时,调用
+`registerXxxTypes(fory)` 并传入应用的 `Fory` 实例。生成的 gRPC 配套代码会自动导入生成的辅助方法。
+
+## gRPC 服务配套代码
+
+`--grpc` 生成 `<module>_grpc.ts`,其中包含服务和路径常量、handler 接口、服务定义和注册辅助方法,以及 `<Service>Client` 类和 `create<Service>Client` 工厂。`--grpc-web` 生成 `<module>_grpc_web.ts`,其中包含回调客户端以及一元 RPC 的 promise 客户端;两种客户端类及其工厂函数都会导出。Node.js 和浏览器用法请参阅 [JavaScript gRPC](../../grpc/javascript.md)。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/kotlin.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/kotlin.md
new file mode 100644
index 0000000000..dfba66192e
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/kotlin.md
@@ -0,0 +1,147 @@
+---
+title: Kotlin
+sidebar_position: 11
+id: kotlin
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+Kotlin 目标只生成 Kotlin 源代码。编译器不会生成 Java 文件。
+
+## 输出布局
+
+对于源文件 `addressbook.fdl`,当它包含 `package addressbook` 时,Kotlin 输出生成在:
+
+- `<kotlin_out>/addressbook/`
+- 类型文件:`AddressBook.kt`、`Person.kt`、`Dog.kt`、`Cat.kt`、`Animal.kt`
+- Schema 模块:`AddressbookForyModule.kt`
+
+Schema 模块名称从源文件主名(stem)派生。同一 Kotlin 包中的 Schema 需要不同的生成文件名;
+写入文件之前会拒绝重复的生成 Kotlin 文件路径。
+
+如果存在 `option kotlin_package = "...";`,输出路径和 Kotlin 包使用该选项。否则
+Kotlin 使用 FDL 包。Kotlin 导入图不能混用默认包 Schema 和命名 Kotlin 包。
+注册仍使用 FDL 包,以保持跨语言类型名称稳定。
+
+## 类型生成
+
+消息默认生成 Kotlin `data class` 声明:
+
+```kotlin
+@ForyStruct
+public data class Person(
+ @field:ForyField(id = 1)
+ public val name: String,
+
+ @field:ForyField(id = 7)
+ public val phones: List<PersonPhoneNumber>,
+
+ @field:ForyField(id = 8)
+ public val pet: Animal,
+) {
+ public fun toBytes(): ByteArray = AddressbookForyModule.getFory().serialize(this)
+
+ public companion object {
+ public fun fromBytes(bytes: ByteArray): Person =
+ AddressbookForyModule.getFory().deserialize(bytes, Person::class.java)
+ }
+}
+```
+
+参与编译器检测到的构造环的消息会生成普通可变类,使生成的序列化器能够在读取反向引用前
+发布实例:
+
+```kotlin
+@ForyStruct
+public class Node() {
+ @ForyField(id = 1)
+ public var id: String = ""
+
+ @Ref
+ @ForyField(id = 2)
+ public var parent: Node? = null
+}
+```
+
+生成的 Kotlin IDL 源代码使用 Kotlin `?` 表示可空性,而不是 Fory `@Nullable`;为编译器
+检测到的构造环生成的可变类也遵循此规则。
+
+枚举生成具有稳定 Fory 枚举 ID 的 Kotlin 枚举类。联合生成带 `@ForyUnion` 的密封类;Fory
+提供的 `Unknown(UnknownCase)` 载体使用 `@ForyUnknownCase` 标记。该标记只选择载体,不会
+向 Schema case 表添加条目。Schema 定义的 case 可以使用 case ID `0..N`,并保存一个
+`value` 属性。类型化联合必须至少包含一个非 `Unknown` case。
+
+```kotlin
+package addressbook
+
+import org.apache.fory.annotation.ForyCase
+import org.apache.fory.annotation.ForyUnion
+import org.apache.fory.annotation.ForyUnknownCase
+import org.apache.fory.type.union.UnknownCase
+
+@ForyUnion
+public sealed class Animal {
+ @ForyUnknownCase
+ public data class Unknown(public val value: UnknownCase) : Animal()
+
+ @ForyCase(id = 0)
+ public data class Dog(public val value: addressbook.Dog) : Animal()
+}
+```
+
+当 Schema case 名称与载荷类型具有相同简单名称时,带包的 Kotlin 输出会保留 Schema
+case 名称并限定载荷类型。如果目标输出模式无法为冲突表达合法限定名,编译器会在生成的
+case 类名后追加 `Case`。
+
+Kotlin `int32`、`int64`、`uint32` 和 `uint64` 字段默认使用 xlang varint 编码,因此生成的
+Kotlin 不会为默认情况生成 `@VarInt`。只有 Schema 请求相应非默认编码时,才生成
+`@Fixed` 或 `@Tagged`。`duration` 映射到 `kotlin.time.Duration`,编码时会拒绝无限
+duration。稠密 `array<float16>` 和 `array<bfloat16>` 使用 Java 核心 `Float16Array` 和
+`BFloat16Array` 载体。生成的 Kotlin IDL 使用 `@ArrayType ByteArray` 表示 `array<int8>`,
+包括嵌套位置。
+
+## Schema 模块
+
+生成的 Schema 模块注册 Schema 类型,并根据目标类名解析 KSP 生成的序列化器。包拥有
+的辅助 Fory 实例使用已安装 Schema 模块的 `ForyKotlin.builder().withXlang(true)`,因此
+消息 `toBytes`/`fromBytes` 辅助方法无需调用方管理 Fory 设置即可工作。对于
+`addressbook.fdl`:
+
+```kotlin
+public object AddressbookForyModule : ForyModule {
+ private val fory: ThreadSafeFory by lazy {
+ ForyKotlin.builder()
+ .withXlang(true)
+ .withRefTracking(true)
+ .withModule(this)
+ .buildThreadSafeFory()
+ }
+
+ internal fun getFory(): ThreadSafeFory = fory
+
+ override fun install(fory: Fory) {
+ KotlinSerializers.registerType(fory, Person::class.java, 100L)
+ KotlinSerializers.registerSerializer(fory, Person::class.java)
+ KotlinSerializers.registerUnion(fory, Animal::class.java, 106L)
+ }
+}
+```
+
+`registerUnion` 会发现生成的 `<Target>_ForySerializer`;调用方无需传入序列化器实例。
+
+## gRPC 服务配套代码
+
+使用 `--grpc` 时,Kotlin 为每个服务生成一个 `<ServiceName>GrpcKt.kt`,而不是 Java 配套代码。生成的对象公开 `SERVICE_NAME`、服务和方法描述符、`<ServiceName>CoroutineImplBase` 和 `<ServiceName>CoroutineStub`。依赖项、KSP 设置以及协程和 `Flow` 用法请参阅 [Kotlin gRPC](../../grpc/kotlin.md)。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/python.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/python.md
new file mode 100644
index 0000000000..441e2dbdbd
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/python.md
@@ -0,0 +1,120 @@
+---
+title: Python
+sidebar_position: 3
+id: python
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## 输出布局
+
+Python 输出为每个 Schema 文件生成一个模块,例如:
+
+- `<python_out>/addressbook.py`
+
+## 类型生成
+
+联合生成 case 枚举和带类型化辅助方法的 `Union` 子类:
+
+```python
+class AnimalCase(Enum):
+ DOG = 1
+ CAT = 2
+
+class Animal(Union):
+ @classmethod
+ def dog(cls, v: Dog) -> "Animal": ...
+
+ def case(self) -> AnimalCase: ...
+ def case_id(self) -> int: ...
+
+ def is_dog(self) -> bool: ...
+ def dog_value(self) -> Dog: ...
+ def set_dog(self, v: Dog) -> None: ...
+```
+
+消息生成 `@pyfory.dataclass` 类型,嵌套类型保持嵌套:
+
+```python
+@pyfory.dataclass
+class Person:
+ class PhoneType(IntEnum):
+ MOBILE = 0
+ HOME = 1
+ WORK = 2
+
+ @pyfory.dataclass
+ class PhoneNumber:
+ number: str = pyfory.field(id=1, default="")
+ phone_type: Person.PhoneType = pyfory.field(id=2, default=None)
+
+ name: str = pyfory.field(id=1, default="")
+ phones: List[Person.PhoneNumber] = pyfory.field(id=7, default_factory=list)
+ pet: Animal = pyfory.field(id=8, default=None)
+
+ def to_bytes(self) -> bytes: ...
+ @classmethod
+ def from_bytes(cls, data: bytes) -> "Person": ...
+```
+
+## 注册
+
+生成的注册函数:
+
+```python
+def register_addressbook_types(fory: pyfory.Fory):
+ fory.register_union(Animal, type_id=106, serializer=AnimalSerializer(fory))
+ fory.register_type(Person, type_id=100)
+ fory.register_type(Person.PhoneType, type_id=101)
+ fory.register_type(Person.PhoneNumber, type_id=102)
+ fory.register_type(Dog, type_id=104)
+ fory.register_type(Cat, type_id=105)
+ fory.register_type(AddressBook, type_id=103)
+```
+
+对于没有显式 `[id=...]` 的 Schema,生成的注册代码使用计算得到的数字 ID:
+
+```python
+fory.register_type(Status, type_id=1124725126)
+fory.register_union(Wrapper, type_id=1471345060, serializer=WrapperSerializer(fory))
+fory.register_type(Envelope, type_id=3022445236)
+fory.register_union(Envelope.Detail, type_id=1609214087, serializer=Envelope.DetailSerializer(fory))
+fory.register_type(Envelope.Payload, type_id=2862577837)
+```
+
+如果设置了 `option enable_auto_type_id = false;`:
+
+```python
+fory.register_type(Config, name="myapp.models.Config")
+fory.register_union(
+ Holder,
+ name="myapp.models.Holder",
+ serializer=HolderSerializer(fory),
+)
+```
+
+## 使用方式
+
+```python
+person = Person(name="Alice", pet=Animal.dog(Dog(name="Rex", bark_volume=10)))
+
+data = person.to_bytes()
+restored = Person.from_bytes(data)
+```
+
+## gRPC 服务配套代码
+
+使用 `--grpc` 时,Python 生成包含 stub、servicer 基类和注册函数的 `<module>_grpc.py`。默认使用异步 `grpc.aio`;`--grpc-python-mode=sync` 保持相同文件名和公共名称。依赖项和使用方式请参阅 [Python gRPC](../../grpc/python.md)。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/rust.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/rust.md
new file mode 100644
index 0000000000..19087a1982
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/rust.md
@@ -0,0 +1,150 @@
+---
+title: Rust
+sidebar_position: 4
+id: rust
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## 输出布局
+
+Rust 输出为每个 Schema 生成一个模块文件,例如:
+
+- `<rust_out>/addressbook.rs`
+
+使用 `--grpc` 且 Schema 包含服务时,Rust 还会生成:
+
+- `<rust_out>/addressbook_service.rs`
+- `<rust_out>/addressbook_service_grpc.rs`
+
+## 类型生成
+
+联合映射到带 `#[fory(id = ...)]` Schema case 属性的 Rust 枚举。
+`#[fory(unknown)] Unknown(::fory::UnknownCase)` 标记 Fory 提供的向前兼容载体。该标记
+只选择载体,不会向 Schema case 表添加条目;Schema case 仍使用完整的 `0..N` ID 范围。
+生成的类型化联合必须至少包含一个非 `Unknown` case。编译器将第一个声明的非 `Unknown`
+case 标记为 `#[fory(default)]`。当该 case 的载荷实现 Rust 标准 `Default` trait 时,编译器
+还会从该 case 生成标准 `Default` 实现:
+
+```rust
+#[derive(::fory::ForyUnion, Clone, Debug, PartialEq, Eq, Hash)]
+pub enum Animal {
+ #[fory(unknown)]
+ Unknown(::fory::UnknownCase),
+ #[fory(id = 0, default)]
+ Dog(self::Dog),
+ #[fory(id = 1)]
+ Cat(self::Cat),
+}
+
+impl ::std::default::Default for Animal {
+ fn default() -> Self {
+ Self::Dog(<self::Dog as ::std::default::Default>::default())
+ }
+}
+```
+
+如果所选载荷没有实现标准 `Default`,例如 `any` 载荷,则生成的联合没有不会失败的
+`Default` 实现。此模型级默认值独立于 Fory 可失败的反序列化默认值;后者通过相应 codec
+和当前读取上下文重建所选 case。
+
+嵌套类型生成嵌套模块:
+
+```rust
+pub mod person {
+ #[derive(ForyEnum, Debug, Clone, PartialEq, Default)]
+ #[repr(i32)]
+ pub enum PhoneType {
+ #[default]
+ Mobile = 0,
+ Home = 1,
+ Work = 2,
+ }
+
+ #[derive(ForyStruct, Debug, Clone, PartialEq, Default)]
+ pub struct PhoneNumber {
+ #[fory(id = 1)]
+ pub number: String,
+ #[fory(id = 2)]
+ pub phone_type: PhoneType,
+ }
+}
+```
+
+消息派生 `ForyStruct`,并包含 `to_bytes`/`from_bytes` 辅助方法:
+
+```rust
+#[derive(ForyStruct, Debug, Clone, PartialEq, Default)]
+pub struct Person {
+ #[fory(id = 1)]
+ pub name: String,
+ #[fory(id = 7)]
+ pub phones: Vec<person::PhoneNumber>,
+ #[fory(id = 8)]
+ pub pet: Animal,
+}
+```
+
+## 注册
+
+生成的注册函数:
+
+```rust
+pub fn register_types(fory: &mut Fory) -> Result<(), fory::Error> {
+ fory.register_union::<Animal>(106)?;
+ fory.register::<person::PhoneType>(101)?;
+ fory.register::<person::PhoneNumber>(102)?;
+ fory.register::<Person>(100)?;
+ fory.register::<Dog>(104)?;
+ fory.register::<Cat>(105)?;
+ fory.register::<AddressBook>(103)?;
+ Ok(())
+}
+```
+
+对于没有显式 `[id=...]` 的 Schema,生成的注册代码使用计算得到的数字 ID:
+
+```rust
+fory.register::<Status>(1124725126)?;
+fory.register_union::<Wrapper>(1471345060)?;
+fory.register::<Envelope>(3022445236)?;
+fory.register_union::<envelope::Detail>(1609214087)?;
+fory.register::<envelope::Payload>(2862577837)?;
+```
+
+如果设置了 `option enable_auto_type_id = false;`:
+
+```rust
+fory.register_by_name::<Config>("myapp.models.Config")?;
+fory.register_union_by_name::<Holder>("myapp.models.Holder")?;
+```
+
+## 使用方式
+
+```rust
+let person = Person {
+ name: "Alice".into(),
+ pet: Animal::Dog(self::Dog::default()),
+ ..Default::default()
+};
+
+let bytes = person.to_bytes()?;
+let restored = Person::from_bytes(&bytes)?;
+```
+
+## gRPC 服务配套代码
+
+使用 `--grpc` 时,Rust 生成包含异步服务 trait 和路径常量的 `<module>_service.rs`,以及 `<module>_service_grpc.rs`;后者包含 tonic 客户端、服务端、codec 和 `ForyGrpcPayload` 实现,这些实现由模型的 `to_bytes` 和 `from_bytes` 辅助方法支持。依赖项和使用方式请参阅 [Rust gRPC](../../grpc/rust.md)。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/scala.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/scala.md
new file mode 100644
index 0000000000..e137085917
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/scala.md
@@ -0,0 +1,156 @@
+---
+title: Scala
+sidebar_position: 12
+id: scala
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+Scala 目标只生成 Scala 3 源代码。`fory-scala` 产物仍支持 Scala 2.13 和 Scala 3,但生成的
+IDL 源代码和宏派生需要 Scala 3。
+
+## 输出布局
+
+对于 `package addressbook`,Scala 输出生成在:
+
+- `<scala_out>/addressbook/`
+- 类型文件:`AddressBook.scala`、`Person.scala`、`Dog.scala`、`Cat.scala`、`Animal.scala`
+- Schema 模块:`AddressbookForyModule.scala`
+
+对于没有 Scala 包的 Schema,Schema 模块名称从源文件主名(stem)派生,例如 `main.fdl`
+生成 `MainForyModule.scala`。Scala 导入图不能混用默认包 Schema 和命名 Scala 包。
+
+## 类型生成
+
+不在编译器检测到的构造环中的消息会生成 case class:
+
+```scala
+import org.apache.fory.annotation.{ForyField, ForyStruct}
+import org.apache.fory.scala.ForySerializer
+
+@ForyStruct
+final case class Person(
+ @ForyField(id = 1) name: String,
+ @ForyField(id = 3) email: Option[String],
+ @ForyField(id = 7) phones: List[Person.PhoneNumber],
+ @ForyField(id = 8) pet: Animal
+) derives ForySerializer {
+ def toBytes(): Array[Byte] =
+ AddressbookForyModule.getFory.serialize(this)
+}
+
+object Person {
+ def fromBytes(bytes: Array[Byte]): Person =
+ AddressbookForyModule.getFory.deserialize(bytes).asInstanceOf[Person]
+}
+```
+
+循环构造环中的消息会生成具有可变序列化字段的普通类,使读取代码可以在读取反向引用前
+注册对象:
+
+```scala
+import org.apache.fory.annotation.{ForyField, ForyStruct, Ref}
+import org.apache.fory.scala.ForySerializer
+
+@ForyStruct
+final class Node() derives ForySerializer {
+ @ForyField(id = 1)
+ var id: String = ""
+
+ @Ref
+ @ForyField(id = 2)
+ var parent: Option[Node] = None
+}
+```
+
+枚举生成具有稳定 Fory ID 的 Scala 3 枚举:
+
+```scala
+import org.apache.fory.annotation.ForyEnumId
+
+enum PhoneType {
+ @ForyEnumId(0)
+ case Mobile
+
+ @ForyEnumId(1)
+ case Home
+
+ @ForyEnumId(2)
+ case Work
+}
+```
+
+联合生成 Scala 3 ADT 枚举。`Unknown(UnknownCase)` 是 Fory 提供的向前兼容载体,使用
+`@ForyUnknownCase` 标记。它不会出现在 Schema case 表中,因为该标记只选择载体,不会
+添加 Schema 条目。Schema 定义的 case 使用非负 `@ForyCase` ID。类型化联合必须至少
+包含一个非 `Unknown` case。
+
+```scala
+package addressbook
+
+import org.apache.fory.annotation.{ForyCase, ForyUnion, ForyUnknownCase}
+import org.apache.fory.scala.ForySerializer
+import org.apache.fory.`type`.union.UnknownCase
+
+@ForyUnion
+enum Animal derives ForySerializer {
+ @ForyUnknownCase
+ case Unknown(value: UnknownCase)
+
+ @ForyCase(id = 0)
+ case Dog(value: _root_.addressbook.Dog)
+
+ @ForyCase(id = 1)
+ case Cat(value: _root_.addressbook.Cat)
+}
+```
+
+当 Schema case 名称与载荷类型具有相同简单名称时,带包的 Scala 输出会保留 Schema
+case 名称并限定载荷类型。如果目标输出模式无法为冲突表达合法限定名,编译器会在生成的
+case 名称后追加 `Case`。
+
+`optional T` 字段生成 `Option[T]`。顶层消息引用在字段或构造函数参数上使用 `@Ref`。
+嵌套元素/值引用使用 `List[Node @Ref]` 等类型使用位置注解。
+
+## Schema 模块
+
+生成的 Schema 模块注册 Schema 序列化器、枚举、struct 和联合。包拥有的辅助 Fory
+实例使用已安装 Schema 模块的 `ForyScala.builder().withXlang(true)`,因此消息
+`toBytes`/`fromBytes` 辅助方法无需调用方管理 Fory 设置即可工作:
+
+```scala
+object AddressbookForyModule extends org.apache.fory.ForyModule {
+ private lazy val fory: ThreadSafeFory =
+ ForyScala.builder()
+ .withXlang(true)
+ .withRefTracking(true)
+ .withModule(this)
+ .buildThreadSafeFory()
+
+ private[addressbook] def getFory: ThreadSafeFory = fory
+
+ override def install(fory: Fory): Unit = {
+ ScalaSerializers.registerEnum(fory, classOf[Person.PhoneType], 101L)
+ ForySerializer.register(fory, classOf[Person.PhoneNumber], 102L)
+ ForySerializer.register(fory, classOf[Person], 100L)
+ ForySerializer.register(fory, classOf[Animal], 106L)
+ }
+}
+```
+
+## gRPC 服务配套代码
+
+使用 `--grpc` 时,Scala 在生成模型的包中为每个本地服务生成一个 `<ServiceName>Grpc.scala` 对象。它公开 `SERVICE_NAME`、服务和方法描述符、`<ServiceName>ImplBase` 和 `<ServiceName>Client`。`RpcFuture`、`RpcIterator`、grpc-java 变体和生命周期指南请参阅 [Scala gRPC](../../grpc/scala.md)。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/swift.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/swift.md
new file mode 100644
index 0000000000..2cefba1bf7
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/generated-code/swift.md
@@ -0,0 +1,102 @@
+---
+title: Swift
+sidebar_position: 9
+id: swift
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## 输出布局
+
+Swift 输出为每个 Schema 生成一个 `.swift` 文件,例如:
+
+- `<swift_out>/addressbook/addressbook.swift`
+
+## 类型生成
+
+生成器使用拆分模型宏和稳定字段/case ID 创建 Swift 模型。类型化联合必须包含
+`@ForyUnknownCase case unknown(UnknownCase)` 和至少一个非 `unknown` case;
+`unknown(UnknownCase)` 只是 Fory 提供的向前兼容载体。该标记只选择载体,不会向 Schema
+case 表添加条目。
+
+当包/命名空间非空时,命名空间形状由 `swift_namespace_style` 控制:
+
+- `enum`(默认):嵌套枚举命名空间包装器。
+- `flatten`:顶层类型名称使用从包派生的前缀(例如 `Demo_Foo_User`)。
+
+当包/命名空间为空时,不应用枚举包装器或扁平化前缀。
+
+对于使用默认 `enum` 风格的非空包:
+
+```swift
+public enum Addressbook {
+ @ForyUnion
+ public enum Animal {
+ @ForyUnknownCase
+ case unknown(UnknownCase)
+ @ForyCase(id: 0)
+ case dog(Addressbook.Dog)
+ @ForyCase(id: 1)
+ case cat(Addressbook.Cat)
+ }
+
+ @ForyStruct
+ public struct Person: Equatable {
+ @ForyField(id: 1)
+ public var name: String = ""
+ @ForyField(id: 8)
+ public var pet: Addressbook.Animal =
+ Addressbook.Animal.dog(Addressbook.Dog())
+ }
+}
+```
+
+对于使用 `flatten` 风格的非空包:
+
+```swift
+@ForyStruct
+public struct Addressbook_Person: Equatable { ... }
+```
+
+两者都设置时,CLI flag `--swift_namespace_style` 会覆盖 Schema 选项 `swift_namespace_style`。
+
+联合生成为带关联载荷值的 tagged Swift 枚举。递归联合生成为 `indirect` 枚举。第一个已知
+联合 case 必须具有有限、可递归构造的默认值;编译器会拒绝第一个 case 的默认值环,而
+不是生成不会终止的初始化器。带 `ref`/`weak_ref` 字段的消息生成为 `final class` 模型,
+以保留引用语义。直接存储的消息环必须将至少一条环边标记为 `ref`;否则编译器会拒绝
+Schema,因为 Swift 值类型无法表示这种结构。list/map 字段中的固定或 tagged 整数编码
+生成为 Swift 字段类型提示,例如 `@ListField(element: .encoding(.fixed))` 或
+`@MapField(value: .encoding(.tagged))`。对于非空固定宽度整数 list 元素,Swift 将字段
+分类为对应的 Fory 基本类型 packed-array 类型;固定宽度整数 set 仍为 Fory set。
+
+## 模块安装
+
+每个 Schema 都包含一个具有传递导入安装能力的 `ForyModule` 所有者:
+
+```swift
+public enum ForyModule {
+ public static func install(_ fory: Fory) throws {
+ try ComplexPb.ForyModule.install(fory)
+ try fory.register(Addressbook.Person.self, id: 100)
+ try fory.register(Addressbook.Animal.self, id: 106)
+ }
+}
+```
+
+对于非空包和 `flatten` 风格,辅助类型也会添加前缀(例如 `Addressbook_ForyModule`)。
+
+对于没有显式 `[id=...]` 的 Schema,安装代码使用计算得到的数字 ID。如果设置了
+`option enable_auto_type_id = false;`,生成的代码使用基于名称的注册 API。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/getting-started.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/getting-started.md
new file mode 100644
index 0000000000..5989bfa88f
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/getting-started.md
@@ -0,0 +1,46 @@
+---
+title: 快速开始
+sidebar_position: 1
+id: getting-started
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+本指南介绍 Fory IDL 编译器的安装、使用和集成。
+
+## 安装
+
+### 从源代码安装
+
+```bash
+cd compiler
+pip install -e .
+```
+
+### 验证安装
+
+```bash
+foryc --help
+```
+
+## 第一次生成
+
+```bash
+foryc example.fdl --lang java,python --output ./generated
+```
+
+继续阅读 [CLI 参考](cli.md)以了解前端和输出选项,或阅读
+[构建集成](build-integration.md)以从应用构建中运行代码生成。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/index.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/index.md
index 0694890f7d..f86309410a 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/index.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/index.md
@@ -1,6 +1,6 @@
---
-title: 概览
-sidebar_position: 1
+title: 概述
+sidebar_position: 0
id: index
license: |
Licensed to the Apache Software Foundation (ASF) under one or more
@@ -19,12 +19,15 @@ license: |
limitations under the License.
---
-Fory IDL 是 Apache Fory 的 Schema 定义语言,可实现类型安全的跨语言序列化。
-你只需定义一次数据结构,即可为 Java、Python、Go、Rust、C++、C#、Swift、Dart、Scala、Kotlin 和 JavaScript/TypeScript 生成原生数据结构代码。Fory IDL 也可以描述 RPC service;对于 Java、Python、Go、Rust、C#、Dart、Scala、Kotlin 和 JavaScript,compiler 可以生成使用 Fory 序列化 request/response payload 的 gRPC service companion。
+Fory IDL 是 Apache Fory 的 Schema 定义语言,可实现类型安全的跨语言序列化。只需定义
+一次数据结构,即可为 Java、Python、C++、Go、Rust、JavaScript/TypeScript、C#、Swift、
+Dart、Scala 和 Kotlin 生成原生数据结构代码。Fory IDL 还可以描述 RPC 服务;对于 Java、
+Python、Go、Rust、C++、C#、Dart、Scala、Kotlin 和 JavaScript,编译器可以生成使用 Fory
+序列化请求和响应载荷的 gRPC 服务配套代码。
-## 示例 Schema
+## Schema 示例
-Fory IDL 提供了简单直观的语法来定义跨语言数据结构:
+Fory IDL 提供简单直观的语法来定义跨语言数据结构:
```protobuf
package example;
@@ -68,41 +71,67 @@ union Animal [id=106] {
Dog dog = 1;
Cat cat = 2;
}
+
+message LookupRequest [id=107] {
+ string name = 1;
+}
+
+message LookupResponse [id=108] {
+ Animal animal = 1;
+}
+
+service AnimalService {
+ rpc Lookup (LookupRequest) returns (LookupResponse);
+ rpc Classify (Animal) returns (Animal);
+}
+```
+
+使用以下命令生成 Java、Python、Go、Rust、C++、C#、Dart、Scala、Kotlin 和 JavaScript
+模型及 gRPC 服务配套代码:
+
+```bash
+foryc animals.fdl --java_out=./generated/java --python_out=./generated/python --go_out=./generated/go --rust_out=./generated/rust --cpp_out=./generated/cpp --csharp_out=./generated/csharp --dart_out=./generated/dart --scala_out=./generated/scala --kotlin_out=./generated/kotlin --javascript_out=./generated/javascript --grpc
```
+生成的服务代码使用常规 gRPC API,但请求和响应对象通过 Fory 序列化。运行时依赖项、
+服务端和客户端设置、流式模式、浏览器支持及互操作性边界请参阅
+[Fory gRPC](../grpc/index.md)。
+
## 为什么选择 Fory IDL?
### Schema 优先开发
-在 Fory IDL 中一次定义数据模型,即可在所有语言中生成一致且类型安全的代码。这样可以确保:
+只需在 Fory IDL 中定义一次数据模型,即可为所有语言生成一致且类型安全的代码。这可以确保:
-- **类型安全**:在编译期而不是运行期发现类型错误
-- **一致性**:各语言使用相同字段名、类型和结构
-- **文档性**:Schema 本身就是可持续演进的文档
-- **可演进性**:可在所有实现中受控地进行 Schema 变更
+- **类型安全**:在编译时而不是代码运行时发现类型错误
+- **一致性**:所有语言使用相同的字段名称、类型和结构
+- **文档**:Schema 可作为持续更新的文档
+- **演进**:统一管理所有实现中的 Schema 变更
-### Fory 原生能力
+### Fory 原生功能
-与通用 IDL 不同,Fory IDL 专门为 Fory 序列化设计:
+与通用 IDL 不同,Fory IDL 专为 Fory 序列化设计:
-- **引用跟踪**:通过 `ref` 一等支持共享引用和循环引用
-- **可空字段**:通过 `optional` 显式声明可空类型
-- **类型注册**:内置支持数值 ID 与基于命名空间的注册
-- **原生代码生成**:生成带 Fory 注解/宏的语言惯用代码
+- **引用跟踪**:通过 `ref` 对共享引用和循环引用提供一等支持
+- **可空字段**:通过显式 `optional` 修饰符表示可空类型
+- **类型注册**:内置支持数字 ID 和基于名称的注册
+- **原生代码生成**:生成带 Fory 注解/宏且符合语言习惯的代码
-### 集成开销低
+### 较低的集成开销
-生成代码直接使用各语言原生构造:
+生成的代码使用原生语言构造:
- Java:带 `@ForyField` 注解的普通 POJO
- Python:带类型提示的 dataclass
-- Go:带 struct tag 的结构体
-- Rust:带 `#[derive(ForyObject)]` 的结构体
-- C++:带 `FORY_STRUCT` 宏的结构体
-- C#:带 `[ForyStruct]` 的类、`[ForyEnum]` 枚举、`[ForyUnion]` 联合类型及注册辅助函数
-- JavaScript:带注册函数的接口
-- Swift:带 `@ForyObject` 模型、`@ForyField` 元数据和注册辅助函数
-- Dart:带 `@ForyStruct` 类、`@ForyField` 注解和注册辅助函数
+- Go:带 struct tag 的 struct
+- Rust:带 `#[derive(ForyStruct)]` 的 struct
+- C++:带 `FORY_STRUCT` 宏的 struct
+- C#:`[ForyStruct]` 类、`[ForyEnum]` 枚举、`[ForyUnion]` 联合和注册辅助方法
+- JavaScript/TypeScript:带 Schema 模块辅助方法的接口
+- Swift:带字段/case 元数据和注册辅助方法的 Fory 模型宏
+- Dart:使用 `@ForyStruct` 的类,带有 `@ForyField` 注解和注册辅助方法
+- Scala:带宏派生序列化器的 Scala 3 `case class`、普通类、枚举和 ADT 枚举模型
+- Kotlin:带 KSP 生成序列化器的 Kotlin `data class`、枚举和密封类模型
## 快速开始
@@ -112,7 +141,7 @@ union Animal [id=106] {
pip install fory-compiler
```
-或从源码安装:
+或者从源代码安装:
```bash
cd compiler
@@ -136,24 +165,16 @@ message Person {
### 3. 生成代码
```bash
-# 为所有语言生成
+# Generate for all languages
foryc example.fdl --output ./generated
-# 为指定语言生成
-foryc example.fdl --lang java,python,csharp,javascript,swift,dart --output ./generated
-```
-
-为包含 service 定义的 schema 生成 Java、Python、Go、Rust、C#、Dart、Scala、Kotlin 和 JavaScript model 以及 gRPC service companion:
-
-```bash
-foryc animals.fdl --java_out=./generated/java --python_out=./generated/python --go_out=./generated/go --rust_out=./generated/rust --csharp_out=./generated/csharp --dart_out=./generated/dart --scala_out=./generated/scala --kotlin_out=./generated/kotlin --javascript_out=./generated/javascript --grpc
+# Generate for specific languages
+foryc example.fdl --lang java,python,cpp,csharp,javascript,swift,dart,scala,kotlin --output ./generated
```
-生成的 service 代码使用标准 gRPC API,但 request 和 response 对象使用 Fory 序列化。应用需要自行提供 grpc-java、grpc-kotlin、Scala grpc-java API、`grpcio`、grpc-go、Rust `tonic` 和 `bytes`、C# `Grpc.Core.Api` 及 server/client 依赖,或 Dart `package:grpc`;Fory package 不会把 gRPC 作为硬依赖。Python companion 默认使用 `grpc.aio`,也可以通过 `--grpc-python-mode=sync` 生成同步模式。JavaScript Node.js companion 使用 `@grpc/grpc-js`;浏览器 client 通过 `--grpc-web` 单独生成并使用 `grpc-web`。
+### 4. 使用生成的代码
-### 4. 使用生成代码
-
-**Java:**
+**Java:**
```java
Person person = new Person();
@@ -162,36 +183,46 @@ person.setAge(30);
byte[] data = person.toBytes();
```
-**Python:**
+**Python:**
```python
import pyfory
from example import Person
person = Person(name="Alice", age=30)
-data = bytes(person) # 或 `person.to_bytes()`
+data = bytes(person) # or `person.to_bytes()`
+```
+
+**JavaScript/TypeScript:**
+
+```ts
+import { deserializePerson, serializePerson } from "./generated/example";
+
+const data = serializePerson({ name: "Alice", age: 30, email: null });
+const person = deserializePerson(data);
```
-## 文档导航
+## 文档
-| 文档 | 说明 |
-| -------------------------------------------- | ---------------------------------- |
-| [Fory IDL 语法](schema-idl.md) | 完整语言语法与文法 |
-| [类型系统](schema-idl.md#type-system) | 基础类型、集合类型与类型规则 |
-| [快速开始](getting-started.md) | 安装编译器并生成第一份代码 |
-| [Compiler CLI](cli.md) | 编译器命令与选项 |
-| [构建集成](build-integration.md) | Maven、Gradle、CMake、Bazel 等集成 |
-| [生成代码](generated-code/index.md) | 各目标语言的输出格式 |
-| [Protocol Buffers IDL 支持](protobuf-idl.md) | 与 protobuf 的对比及迁移指南 |
-| [FlatBuffers IDL 支持](flatbuffers-idl.md) | FlatBuffers 映射规则与代码生成差异 |
+| 文档 | 说明 |
+| -------------------------------------------- | ---------------------------------------- |
+| [Fory IDL 语法](schema-idl.md) | 完整的语言语法和文法 |
+| [类型系统](schema-idl.md#type-system) | 基本类型、集合和类型规则 |
+| [RPC 服务](schema-idl.md#service-definition) | 服务和 RPC 方法语法 |
+| [编译器 CLI](cli.md) | 编译器命令和选项 |
+| [构建集成](build-integration.md) | Maven、Gradle、build.rs、CMake、Bazel 等 |
+| [生成的代码](generated-code/index.md) | 各目标语言的输出格式 |
+| [Protocol Buffers IDL 支持](protobuf-idl.md) | Protobuf 映射规则和采用指南 |
+| [FlatBuffers IDL 支持](flatbuffers-idl.md) | FlatBuffers 映射规则和代码生成差异 |
## 核心概念
### 字段修饰符
-- **`optional`**:字段可为 null/None
-- **`ref`**:为共享/循环引用启用引用跟踪
-- **`list`**:字段为列表/数组(别名:`repeated`)
+- **`optional`**:字段可以为 null/None
+- **`ref`**:为共享引用/循环引用启用引用跟踪
+- **`list`**:字段是有序集合(别名:`repeated`)
+- **`array`**:字段是一维稠密 bool 或数值数据
```protobuf
message Example {
@@ -201,26 +232,26 @@ message Example {
}
```
-### 跨语言兼容
+### 跨语言兼容性
-Fory IDL 类型会映射为各语言原生类型:
+Fory IDL 类型映射到各语言的原生类型:
-| Fory IDL 类型 | Java | Python | Go | Rust | C++ | C# | JavaScript | Swift | Dart |
-| ------------- | --------- | -------------- | -------- | -------- | ------------- | -------- | ---------- | -------- | -------- |
-| `int32` | `int` | `pyfory.int32` | `int32` | `i32` | `int32_t` | `int` | `number` | `Int32` | `Int32` |
-| `string` | `String` | `str` | `string` | `String` | `std::string` | `string` | `string` | `String` | `String` |
-| `bool` | `boolean` | `bool` | `bool` | `bool` | `bool` | `bool` | `boolean` | `Bool` | `bool` |
+| Fory IDL 类型 | Java | Python | C++ | Go | Rust | JavaScript/TypeScript | C# | Swift | Dart | Scala | Kotlin |
+| ------------- | --------- | -------------- | ------------- | -------- | -------- | --------------------- | -------- | -------- | -------- | --------- | --------- |
+| `int32` | `int` | `pyfory.Int32` | `int32_t` | `int32` | `i32` | `number` | `int` | `Int32` | `int` | `Int` | `Int` |
+| `string` | `String` | `str` | `std::string` | `string` | `String` | `string` | `string` | `String` | `String` | `String` | `String` |
+| `bool` | `boolean` | `bool` | `bool` | `bool` | `bool` | `boolean` | `bool` | `Bool` | `bool` | `Boolean` | `Boolean` |
-完整映射请参见 [类型系统](schema-idl.md#type-system)。
+完整映射请参阅[类型系统](schema-idl.md#type-system)。
## 最佳实践
-1. **使用有意义的 package 名称**:将相关类型分组管理
-2. **为性能分配类型 ID**:数值 ID 比基于名称的注册更高效
-3. **预留 ID 范围**:为后续扩展保留空隙(例如用户 100-199,订单 200-299)
-4. **显式使用 `optional`**:清晰表达可空语义
-5. **共享对象使用 `ref`**:对象可能被多处引用时开启引用跟踪
+1. **使用有意义的包名称**:将相关类型组织在一起
+2. **为性能分配类型 ID**:数字 ID 比基于名称的注册更快
+3. **预留 ID 范围**:为未来新增内容留出空档(例如用户使用 100-199,订单使用 200-299)
+4. **显式使用 `optional`**:在 Schema 中清楚表达可空性
+5. **对共享对象使用 `ref`**:对象共享时启用引用跟踪
## 示例
-完整可运行示例见 [examples](https://github.com/apache/fory/tree/main/compiler/examples) 目录。
+完整的可运行示例请参阅 [examples](https://github.com/apache/fory/tree/main/compiler/examples) 目录。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/protobuf-idl.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/protobuf-idl.md
index 482cbccd9c..743800e47c 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/protobuf-idl.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/protobuf-idl.md
@@ -1,6 +1,6 @@
---
title: Protobuf IDL 支持
-sidebar_position: 10
+sidebar_position: 5
id: protobuf-idl
license: |
Licensed to the Apache Software Foundation (ASF) under one or more
@@ -19,50 +19,54 @@ license: |
limitations under the License.
---
-本页说明 Apache Fory 如何处理 Protocol Buffers(`.proto`)schema、protobuf 概念如何映射到 Fory,以及 protobuf 专用 Fory 扩展选项的使用方式。
+本页介绍 Apache Fory 如何处理 Protocol Buffers(`.proto`)Schema、protobuf 概念如何
+映射到 Fory,以及如何使用 protobuf 专属的 Fory 扩展选项。
## 本页内容
-- 如何在具体场景下选择 protobuf 或 Fory
-- 迁移时需要关注的语法与语义差异
-- `.proto` 文件中支持的 Fory 扩展选项
-- 从 protobuf 迁移到 Fory 的实践路径
+- 根据使用场景选择 protobuf 或 Fory
+- 采用过程中需要关注的语法和语义差异
+- protobuf 文件中支持的 Fory 扩展选项
+- 从 protobuf 迁移到 Fory 的实用模式
## 快速决策指南
-| 场景 | 建议格式 |
-| ----------------------------------------------------- | ---------------- |
-| 主要构建 gRPC API,依赖 protobuf 工具链 | Protocol Buffers |
-| 需要极致对象图性能与引用跟踪 | Fory |
-| 需要在序列化数据中表达循环/共享引用 | Fory |
-| 需要强 unknown-field 语义保证线格式兼容 | Protocol Buffers |
-| 希望直接使用原生 struct/class,而非 protobuf 包装类型 | Fory |
-
-## Protobuf 与 Fory 对比
-
-| 维度 | Protocol Buffers | Fory |
-| --------- | --------------------- | ---------------------- |
-| 主要目标 | RPC/消息契约 | 高性能对象序列化 |
-| 编码模型 | Tag-Length-Value | Fory 二进制协议 |
-| 引用跟踪 | 非内建 | 一等支持(`ref`) |
-| 循环引用 | 不支持 | 支持 |
-| 未知字段 | 保留 | 不保留 |
-| 生成类型 | protobuf 专用模型类型 | 语言原生构造 |
-| gRPC 生态 | 原生成熟 | Java/Python/Go/Rust/C#/Dart/Scala/Kotlin/JavaScript service codegen |
-
-Fory 可以通过 `--grpc` 生成 Java、Python、Go、Rust、C#、Dart、Scala、Kotlin 和 JavaScript gRPC service companion。JavaScript 浏览器 client 通过 `--grpc-web` 生成。这些 service 使用标准 gRPC 传输,但 request 和 response payload 使用 Fory 序列化,而不是 protobuf。对于广泛的 gRPC 生态工具、schema reflection 和 protobuf-native interceptor,protobuf 仍是更成熟的默认选择。
+| 场景 | 推荐格式 |
+| ------------------------------------------ | ---------------- |
+| 正在构建 gRPC API 并依赖 protobuf 工具 | Protocol Buffers |
+| 需要最佳对象图性能和引用跟踪 | Fory |
+| 序列化数据中需要循环引用/共享引用 | Fory |
+| 编码兼容性需要强大的未知字段行为 | Protocol Buffers |
+| 需要原生 struct/类,而不是 protobuf 包装器 | Fory |
+
+## Protobuf 与 Fory 对比概览
+
+| 方面 | Protocol Buffers | Fory |
+| --------- | --------------------- | ---------------------------------------------------------------- |
+| 主要用途 | RPC/消息契约 | 高性能对象序列化 |
+| 编码模型 | 标签-长度-值 | Fory 二进制协议 |
+| 引用跟踪 | 未内置 | 一等功能(`ref`) |
+| 循环引用 | 不支持 | 支持 |
+| 未知字段 | 保留 | 不保留 |
+| 生成类型 | Protobuf 特有模型类型 | 原生语言构造 |
+| gRPC 生态 | 原生 | Java/Python/Go/Rust/C#/Dart/Scala/Kotlin/JavaScript 服务代码生成 |
+
+Fory 可以使用 `--grpc` 生成 Java、Python、Go、Rust、C#、Dart、Scala、Kotlin 和 JavaScript
+gRPC 服务配套代码。JavaScript 浏览器客户端使用 `--grpc-web` 生成。这些服务使用常规 gRPC
+传输,但通过 Fory 而不是 protobuf 序列化请求和响应载荷。对于广泛的 gRPC 生态工具、
+Schema 反射和 protobuf 原生 interceptor,protobuf 仍是成熟的默认选择。
## 为什么使用 Apache Fory
-- **代码更贴近语言习惯**:Fory IDL 生成的类和结构体可直接作为业务领域对象使用。
-- **序列化性能更高**:在 Fory 基准中,Fory 在对象序列化场景中可显著快于 protobuf。
-- **对象图表达更自然**:共享引用和循环引用是内建能力,无需通过业务层 ID 关联绕过。
+- 符合语言习惯的生成代码:Fory IDL 生成可直接用作领域对象的语言原生类和 struct。
+- 更快的序列化:在 Fory 基准测试中,对于对象序列化工作负载,Fory 可比 protobuf 快约 10 倍。
+- 更好的对象图建模:共享引用和循环引用是一等功能,无需应用级 ID 链接变通方案。
-性能细节请参见 [性能参考](#性能参考)。
+基准测试详情请参阅[性能参考](#performance-references)。
-## 语法与语义映射
+## 语法和语义映射
-### Package 与文件级选项
+### 包和文件选项
**Protocol Buffers**
@@ -79,9 +83,9 @@ option go_package = "example.com/models";
package example.models;
```
-Fory 使用统一 package 命名空间做跨语言注册。语言特定的包路径仍可在代码生成阶段单独配置。
+Fory 使用一个包命名空间进行跨语言注册。代码生成仍可配置语言特有的包位置。
-### Message 与 Enum 定义
+### 消息和枚举定义
**Protocol Buffers**
@@ -119,15 +123,15 @@ enum Status [id=102] {
}
```
-关键差异:
+主要差异:
-- Fory 可直接分配稳定类型 ID(`[id=...]`)。
-- Fory 使用 `list<T>`(`repeated T` 为兼容别名)。
-- 枚举命名更偏向语言习惯,而非 protobuf 前缀风格。
+- Fory 可以直接分配稳定的类型 ID(`[id=...]`)。
+- Fory 使用 `list<T>`(`repeated T` 作为别名)。
+- 枚举命名约定由语言决定,而不是 protobuf 前缀风格。
### `oneof` 到 `union`
-protobuf 的 `oneof` 会被翻译为嵌套 Fory `union`,并增加一个可选字段指向该 union。
+Protobuf `oneof` 会转换为嵌套 Fory `union`,再加上引用该联合的可选字段。
**Protocol Buffers**
@@ -140,7 +144,7 @@ message Event {
}
```
-**转换后的 Fory 结构**
+**转换后的 Fory 风格形式**
```protobuf
message Event {
@@ -154,12 +158,12 @@ message Event {
说明:
-- union case ID 来自原 `oneof` 字段号。
-- 自动生成的 union 引用字段使用 `oneof` 中最小字段号。
+- 联合 case ID 从原始 `oneof` 字段编号派生。
+- 合成的联合字段使用最小的 `oneof` case 编号。
-### Import 与 Well-Known Types
+### 导入和常用类型
-支持 protobuf import。常见 well-known types 会直接映射:
+支持 Protobuf import。常见 well-known 类型直接映射:
- `google.protobuf.Timestamp` -> `timestamp`
- `google.protobuf.Duration` -> `duration`
@@ -167,27 +171,27 @@ message Event {
## 类型映射要点
-| Protobuf Type | Fory 映射 |
-| ---------------------------------------- | ----------------------------- |
-| `bool` | `bool` |
-| `int32`, `uint32` | 可变长 32 位整型家族 |
-| `sint32` | zigzag 32 位整型 |
-| `int64`, `uint64` | 可变长 64 位整型家族 |
-| `sint64` | zigzag 64 位整型 |
-| `fixed32`, `fixed64` | 定长无符号整型家族 |
-| `sfixed32`, `sfixed64` | 定长有符号整型家族 |
-| `float`, `double` | `float32`, `float64` |
-| `string`, `bytes` | `string`, `bytes` |
-| `repeated T` | `list<T>` |
-| `map<K, V>` | `map<K, V>` |
-| `optional T` | `optional T` |
-| `oneof` | `union` + 可选 union 引用字段 |
-| `int64 [(fory).type = "tagged_int64"]` | `tagged_int64` 编码 |
-| `uint64 [(fory).type = "tagged_uint64"]` | `tagged_uint64` 编码 |
+| Protobuf 类型 | Fory 映射 |
+| ---------------------------------------- | -------------------------- |
+| `bool` | `bool` |
+| `int32`, `uint32` | 变长 32 位整数类型 |
+| `sint32` | zigzag 32 位整数 |
+| `int64`, `uint64` | 变长 64 位整数类型 |
+| `sint64` | zigzag 64 位整数 |
+| `fixed32`, `fixed64` | 固定宽度无符号整数类型 |
+| `sfixed32`, `sfixed64` | 固定宽度有符号整数类型 |
+| `float`, `double` | `float32`, `float64` |
+| `string`, `bytes` | `string`, `bytes` |
+| `repeated T` | `list<T>` |
+| `map<K, V>` | `map<K, V>` |
+| `optional T` | `optional T` |
+| `oneof` | `union` + 可选联合引用字段 |
+| `int64 [(fory).type = "tagged int64"]` | `tagged int64` 编码 |
+| `uint64 [(fory).type = "tagged uint64"]` | `tagged uint64` 编码 |
## Fory 扩展选项(Protobuf) {#fory-extension-options-protobuf}
-`.proto` 文件中的 Fory 专用选项使用 `(fory).` 前缀。
+`.proto` 中的 Fory 特有选项使用 `(fory).` 前缀。
```protobuf
option (fory).enable_auto_type_id = true;
@@ -200,62 +204,64 @@ message TreeNode {
### 文件级选项
-| 选项 | 类型 | 说明 |
-| ------------------------------------ | ------ | --------------------------------------------------- |
-| `(fory).use_record_for_java_message` | bool | 对该文件所有 message 生成 Java record |
-| `(fory).polymorphism` | bool | 默认开启多态序列化元信息 |
-| `(fory).enable_auto_type_id` | bool | 缺失时自动生成类型 ID(编译器默认 true) |
-| `(fory).evolving` | bool | message 的默认 schema 演进行为 |
-| `(fory).go_nested_type_style` | string | Go 嵌套命名风格:`underscore`(默认)或 `camelcase` |
-
-### Message 与 Enum 级选项
-
-| 选项 | 作用对象 | 类型 | 说明 |
-| ---------------------------- | ------------- | ------ | ----------------------------- |
-| `(fory).id` | message, enum | int | 显式类型 ID(用于注册) |
-| `(fory).alias` | message, enum | string | 自动 ID 哈希使用的别名 |
-| `(fory).evolving` | message | bool | 覆盖文件级演进设置 |
-| `(fory).use_record_for_java` | message | bool | 为该 message 生成 Java record |
-| `(fory).deprecated` | message, enum | bool | 标记类型为弃用 |
-| `(fory).namespace` | message | string | 覆盖默认 package 命名空间 |
+| 选项 | 类型 | 说明 |
+| ------------------------------------ | ------ | ---------------------------------------------------------------- |
+| `(fory).use_record_for_java_message` | bool | 为此文件中的所有消息生成 Java record |
+| `(fory).polymorphism` | bool | 默认启用多态序列化元数据 |
+| `(fory).enable_auto_type_id` | bool | 省略时自动生成类型 ID(编译器默认为 true) |
+| `(fory).evolving` | bool | 消息的默认 Schema 演进行为 |
+| `(fory).go_nested_type_style` | string | Go 嵌套命名风格:`underscore`(默认)或 `camelcase` |
+| `(fory).swift_namespace_style` | string | Swift 命名空间风格:`enum`(默认)或 `flatten`;仅在包非空时适用 |
+
+### 消息和枚举选项
+
+| 选项 | 适用于 | 类型 | 说明 |
+| ---------------------------- | ------------- | ------ | --------------------------- |
+| `(fory).id` | message, enum | int | 用于注册的显式类型 ID |
+| `(fory).alias` | message, enum | string | 用于自动 ID hash 的替代名称 |
+| `(fory).evolving` | message | bool | 覆盖文件级演进设置 |
+| `(fory).use_record_for_java` | message | bool | 为此消息生成 Java record |
+| `(fory).deprecated` | message, enum | bool | 将类型标记为已弃用 |
+| `(fory).namespace` | message | string | 覆盖基于包的默认命名空间 |
### 字段级选项 {#field-level-options}
-| 选项 | 类型 | 说明 |
-| ---------------------------- | ------ | --------------------------------------------------------------------- |
-| `(fory).ref` | bool | 为该字段启用引用跟踪 |
-| `(fory).nullable` | bool | 将字段视为可空(`optional`) |
-| `(fory).weak_ref` | bool | 生成弱指针语义(C++/Rust 代码生成) |
-| `(fory).thread_safe_pointer` | bool | 对 ref 字段使用 Rust `Arc`/`ArcWeak`;默认 `false` 使用 `Rc`/`RcWeak` |
-| `(fory).deprecated` | bool | 标记字段为弃用 |
-| `(fory).type` | string | 基础类型覆盖,目前支持 `tagged_int64`/`tagged_uint64` |
+| 选项 | 类型 | 说明 |
+| ---------------------------- | ------ | ------------------------------------------------------------------------------------ |
+| `(fory).ref` | bool | 为此字段启用引用跟踪 |
+| `(fory).nullable` | bool | 将字段视为可空(`optional`) |
+| `(fory).weak_ref` | bool | 生成弱指针语义(C++/Rust 代码生成) |
+| `(fory).thread_safe_pointer` | bool | Rust ref 载体选择;默认 `true` 使用 `Arc`/`ArcWeak`,显式 `false` 使用 `Rc`/`RcWeak` |
+| `(fory).deprecated` | bool | 将字段标记为已弃用 |
+| `(fory).type` | string | 用于 tagged 64 位整数编码的基本类型覆盖 |
-引用相关行为:
+引用选项行为:
-- `weak_ref = true` 隐含开启 ref 跟踪。
-- 对 `repeated` 字段,`(fory).ref = true` 作用于列表元素。
-- 对 `map<K, V>` 字段,`(fory).ref = true` 作用于 map value。
-- `weak_ref` 与 `thread_safe_pointer` 是 C++/Rust 代码生成提示。
-- `thread_safe_pointer` 默认为 `false`;它只改变生成的 Rust 指针承载类型,不改变编码格式。
-- 在 Rust 代码生成中,`(fory).weak_ref = true` 默认使用 `RcWeak`;只有同时设置
- `(fory).thread_safe_pointer = true` 时才会切换为 `ArcWeak`。
+- `weak_ref = true` 隐含引用跟踪。
+- 对于 `repeated` 字段,`(fory).ref = true` 应用于 list 元素。
+- 对于 `map<K, V>` 字段,`(fory).ref = true` 应用于 map 值。
+- `weak_ref` 和 `thread_safe_pointer` 是 C++/Rust 代码生成提示。
+- `thread_safe_pointer` 默认为 `true`;它只改变生成的 Rust 指针载体,不会改变编码格式。
+- 在 Rust 代码生成中,`(fory).weak_ref = true` 默认使用 `ArcWeak`,只会切换为
+ `RcWeak`;切换条件是设置 `(fory).thread_safe_pointer = false`。
-### 典型选项组合示例
+### 按形状展示选项示例
```protobuf
message Graph {
- Node root = 1 [(fory).ref = true, (fory).thread_safe_pointer = true];
+ Node root = 1 [(fory).ref = true];
repeated Node nodes = 2 [(fory).ref = true];
map<string, Node> cache = 3 [(fory).ref = true];
Node parent = 4 [(fory).weak_ref = true];
+ Node local = 5 [(fory).ref = true, (fory).thread_safe_pointer = false];
}
```
-## 引用跟踪 vs Protobuf ID 关联
+## 引用跟踪与 Protobuf ID 对比
-protobuf 本身不保留共享/循环对象图。借助 Fory protobuf 扩展,可以显式启用对象图语义。
+Protobuf 本身不保留共享/循环对象图。使用 Fory protobuf 扩展可以选择启用对象图语义。
-**不使用 Fory ref 选项(protobuf 风格 ID 关联):**
+**不使用 Fory ref 选项(protobuf 风格 ID):**
```protobuf
message TreeNode {
@@ -265,7 +271,7 @@ message TreeNode {
}
```
-**使用 Fory ref 选项(对象图语义):**
+**使用 Fory ref 选项(对象图):**
```protobuf
message TreeNode {
@@ -274,42 +280,51 @@ message TreeNode {
}
```
-## 迁移指南:Protobuf 到 Fory
+## 将 Protobuf Schema 迁移到 Fory
-### 第 1 步:转换 schema 语法
+### 第 1 步:转换 Schema 语法
-- 保持 package 名称稳定。
-- 将 `repeated T` 改为 `list<T>`(或保留 `repeated` 别名)。
-- 在需要稳定数值注册的位置添加显式 `[id=...]`。
+- 保持包名称稳定。
+- 将 `repeated T` 替换为 `list<T>`(或保留 `repeated` 别名)。
+- 在需要稳定数字注册的位置添加显式 `[id=...]`。
-### 第 2 步:处理 `oneof` 与特殊类型
+### 第 2 步:转换 `oneof` 和特殊类型
-- `oneof` -> `union` + 可选 union 字段。
-- 将 protobuf well-known types 映射到 Fory 基础类型(`timestamp`、`duration`、`any`)。
+- `oneof` -> `union` + 可选联合字段。
+- 将 protobuf well-known 类型映射到 Fory 基本类型(`timestamp`、`duration`、`any`)。
-### 第 3 步:用 `ref` 替换 protobuf 的对象图绕过方案
+### 第 3 步:使用 `ref` 替换 Protobuf 变通方案
-若 protobuf 里通过手工 ID 关联表达对象图,迁移到 Fory 后应改用 `ref` 修饰符(必要时使用 `ref(weak=true)`)。
+对于 protobuf 使用手动 ID 链接表示对象图的位置,改用 Fory `ref` 修饰符(并在需要时
+使用可选的 `ref(weak=true)`)。
-### 第 4 步:更新构建与代码生成
+### 第 4 步:更新构建/代码生成
-将 protobuf 代码生成步骤替换为 Fory 编译器针对目标语言的生成命令。
+使用目标语言的 Fory 编译器调用替换 protobuf 生成步骤。
-对于支持的 service 输出,添加 `--grpc` 以生成 gRPC companion 代码:
+对于支持的服务输出,添加 `--grpc` 以生成 gRPC 配套代码:
```bash
foryc api.proto --java_out=./generated/java --python_out=./generated/python --go_out=./generated/go --rust_out=./generated/rust --csharp_out=./generated/csharp --dart_out=./generated/dart --scala_out=./generated/scala --kotlin_out=./generated/kotlin --javascript_out=./generated/javascript --grpc
```
-生成的 Java service 文件依赖 grpc-java;Python service module 默认使用 `grpc.aio`;Rust service 文件导入 `tonic` 和 `bytes`;Go service 文件导入 grpc-go;JavaScript Node.js service 文件导入 `@grpc/grpc-js`;C# service 文件导入 `Grpc.Core.Api` 类型;Dart service 文件导入 `package:grpc`;Scala service 文件依赖 grpc-java;Kotlin service 文件依赖 grpc-java 和 grpc-kotlin。请在应用构建中加入这些依赖;Fory package 不会把 gRPC 作为硬依赖。同步 Python `grpcio` companion 可使用 `--grpc-python-mode=sync`。JavaScript 输出配合 `--grpc-web` 可生成导入 `grpc-web` 的浏览器 client。
+生成的 Java 服务文件依赖 grpc-java 编译;生成的 Python 服务模块默认使用 `grpc.aio`;
+生成的 Rust 服务文件导入 `tonic` 和 `bytes`;生成的 Go 服务文件导入 grpc-go;生成的
+JavaScript Node.js 服务文件导入 `@grpc/grpc-js`;生成的 C# 服务文件导入
+`Grpc.Core.Api` 类型;生成的 Dart 服务文件导入 `package:grpc`;生成的 Scala 服务文件
+依赖 grpc-java 编译;生成的 Kotlin 服务文件依赖 grpc-java 和 grpc-kotlin 编译。请在应用
+构建中添加这些依赖项;Fory 软件包不会将 gRPC 添加为硬依赖项。请使用
+`--grpc-python-mode=sync` 生成同步 Python `grpcio` 配套代码。对 JavaScript 输出使用 `--grpc-web` 可生成导入
+`grpc-web` 的浏览器客户端。Protobuf `oneof` 字段会转换为请求和响应消息中的 Fory 联合
+字段。直接使用联合作为 RPC 请求或响应类型不属于常规 protobuf RPC 语法。
-### 第 5 步:执行兼容性验证
+### 第 5 步:运行兼容性检查
-分阶段迁移时,可并行保留两种格式,并通过集成测试验证 payload 级一致性。
+对于分阶段迁移,请并行保留两种格式,并通过集成测试验证载荷级一致性。
## 共存策略
-迁移期间可以并行运行 protobuf 与 Fory:
+在分阶段迁移期间,可以并行运行 protobuf 和 Fory:
```java
public byte[] serialize(Object obj, Format format) {
@@ -320,13 +335,14 @@ public byte[] serialize(Object obj, Format format) {
}
```
-可在服务边界设置转换层,并优先迁移内部对象图较重的链路。
+在服务边界使用转换器,同时优先迁移大量使用对象图的内部路径。
-## 性能参考
+## 性能参考 {#performance-references}
-- Benchmarks: https://fory.apache.org/docs/introduction/benchmark
-- Benchmark code: https://github.com/apache/fory/tree/main/benchmarks
+- 基准测试:https://fory.apache.org/docs/benchmarks/
+- 基准测试代码:https://github.com/apache/fory/tree/main/benchmarks
## 总结
-当主要关注 API 契约与 gRPC 生态时,建议使用 protobuf。若主要关注对象图性能、原生数据模型与引用语义,建议使用 Fory。
+主要关注 API 契约和 gRPC 生态集成时,请使用 protobuf。主要关注对象图性能、原生模型和
+引用语义时,请使用 Fory。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/schema-idl.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/schema-idl.md
index 57750a91ae..9c7a41357c 100644
--- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/schema-idl.md
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/compiler/schema-idl.md
@@ -1,6 +1,6 @@
---
title: Schema IDL 语法
-sidebar_position: 2
+sidebar_position: 3
id: schema-idl
license: |
Licensed to the Apache Software Foundation (ASF) under one or more
@@ -19,20 +19,22 @@ license: |
limitations under the License.
---
-本文档提供 Fory IDL 的语法与语义参考。
+本文档提供 Fory IDL 的语法和语义参考。
-编译器使用方式与构建集成请参见[快速开始](getting-started.md)与[构建集成](build-integration.md)。
-protobuf/FlatBuffers 前端映射请参见 [Protocol Buffers IDL Support](protobuf-idl.md) 与 [FlatBuffers IDL Support](flatbuffers-idl.md)。
+有关编译器的使用和构建集成,请参阅
+[编译指南](cli.md)。用于 protobuf/FlatBuffers 前端映射
+规则,请参见[协议缓冲区 IDL 支持](protobuf-idl.md) 和
+[FlatBuffers IDL 支持](flatbuffers-idl.md)。
## 文件结构
-一个 Fory IDL 文件通常包含:
+Fory IDL 文件通常包含:
-1. 可选 `package` 声明
-2. 可选文件级 `option`
-3. 可选 `import` 语句
-4. 类型定义(`enum`、`message`、`union`)
-5. 可选的 `service` 定义
+1. 可选的 package 声明
+2. 可选的文件级选项
+3. 可选的 import 语句
+4. 类型定义(枚举、消息和联合类型)
+5. 可选的服务定义
```protobuf
// Optional package declaration
@@ -59,7 +61,7 @@ service OrderService {
## 注释
-支持单行注释与块注释:
+Fory IDL 支持单行注释和块注释:
```protobuf
// This is a single-line comment
@@ -76,45 +78,45 @@ message Example {
## Package 声明
-`package` 定义文件中所有类型的命名空间。
+包声明定义文件中所有类型的命名空间。
```protobuf
package com.example.models;
```
-也可以配置 alias(用于自动类型 ID 计算):
+您可以选择指定用于自动生成的类型 ID 的包别名:
```protobuf
package com.example.models alias models_v1;
```
-规则:
+**规则:**
- 可选但推荐
-- 必须位于任何类型定义之前
-- 每个文件最多一个 `package`
-- 用于命名空间注册
-- `alias` 会参与 auto-ID 哈希
-
-语言映射:
-
-| 语言 | package 用法 |
-| --------------------- | ---------------------------- |
-| Java | Java package |
-| Python | 模块名(`.` 转 `_`) |
-| Go | 包名(取最后一段) |
-| Rust | 模块名(`.` 转 `_`) |
-| C++ | 命名空间(`.` 转 `::`) |
-| C# | 命名空间 |
-| JavaScript/TypeScript | TypeScript 模块名 |
-| Swift | 命名空间包装类型或名称前缀 |
-| Dart | 库名(保留 package 各段) |
-| Scala | Scala package |
-| Kotlin | Kotlin package |
+- 必须出现在任何类型定义之前
+- 每个文件只有一个包声明
+- 用于基于名称的类型注册
+- 包别名用于自动 ID 哈希
+
+**语言映射:**
+
+| 语言 | 包的用途 |
+| --------------------- | ---------------------- |
+| Java | Java 包 |
+| Python | 模块名称(点到下划线) |
+| Go | 包名称(最后一个组件) |
+| Rust | 模块名称(点到下划线) |
+| C++ | 命名空间(点到 `::`) |
+| C# | 命名空间 |
+| JavaScript/TypeScript | TypeScript 模块名称 |
+| Swift | 命名空间包装器或前缀 |
+| Dart | 库名称(包段) |
+| Scala | Scala包 |
+| Kotlin | Kotlin包 |
## 文件级选项
-文件级选项用于控制特定语言的代码生成。
+可以在文件级别指定选项来控制特定于语言的代码生成。
### 语法
@@ -124,7 +126,7 @@ option option_name = value;
### Java Package 选项
-通过 `java_package` 覆盖 Java 输出包名:
+覆盖生成代码的 Java 包:
```protobuf
package payment;
@@ -135,15 +137,15 @@ message Payment {
}
```
-效果:
+**影响:**
-- Java 文件输出到 `com/mycorp/payment/v1/`
-- Java `package` 声明使用该值
-- 跨语言类型注册仍以 Fory package(如 `payment`)为准
+- 生成的Java文件将位于`com/mycorp/payment/v1/`目录中
+- Java 包声明将为 `package com.mycorp.payment.v1;`
+- 类型注册仍然使用Fory IDL包(`payment`)以实现跨语言兼容性
### Go Package 选项
-通过 `go_package` 指定 Go import path 与包名:
+指定Go导入路径和包名:
```protobuf
package payment;
@@ -154,17 +156,17 @@ message Payment {
}
```
-格式为 `"import/path;package_name"`,也可以只写 `"import/path"`(此时以最后一段作为包名)。
+**格式:** `"import/path;package_name"` 或 `"import/path"` (最后一段用作包名称)
-效果:
+**影响:**
-- 生成的 Go 文件使用 `package paymentv1`
-- 其他 Go 代码可以使用该 import path
-- 跨语言类型注册仍以 Fory IDL package(`payment`)为准
+- 生成的 Go文件将有`package paymentv1`
+- 导入路径可以在其他Go代码中使用
+- 类型注册仍然使用Fory IDL包(`payment`)以实现跨语言兼容性
-### C# Namespace 选项
+### C# 命名空间选项
-通过 `csharp_namespace` 覆盖生成代码的 C# 命名空间:
+覆盖生成代码的 C# 命名空间:
```protobuf
package payment;
@@ -175,15 +177,15 @@ message Payment {
}
```
-效果:
+**影响:**
- 生成的 C# 文件使用 `namespace MyCorp.Payment.V1;`
-- 输出路径遵循命名空间分段(位于 `--csharp_out` 下的 `MyCorp/Payment/V1/`)
-- 跨语言类型注册仍以 Fory IDL package(`payment`)为准
+- 输出路径遵循命名空间段(`MyCorp/Payment/V1/` 位于 `--csharp_out` 下)
+- 类型注册仍然使用Fory IDL包(`payment`)以实现跨语言兼容性
### Kotlin Package 选项
-通过 `kotlin_package` 覆盖生成源码的 Kotlin package:
+覆盖生成源的 Kotlin 包:
```protobuf
package payment;
@@ -194,17 +196,17 @@ message Payment {
}
```
-效果:
+**影响:**
- 生成的 Kotlin 文件写入 `com/mycorp/payment/v1/`
-- Kotlin 源码使用 `package com.mycorp.payment.v1`
-- 跨语言类型注册仍以 Fory IDL package(`payment`)为准
+- Kotlin 源使用 `package com.mycorp.payment.v1`
+- 为保持跨语言兼容性,类型注册仍使用 Fory IDL package(`payment`)
-未配置 `kotlin_package` 时,Kotlin 使用 FDL package。Kotlin import 图不能混用默认 package 的 Schema 与命名 Kotlin package。
+如果未设置 `kotlin_package`,Kotlin 将使用 FDL package。Kotlin 导入图不能混用默认 package Schema 与具名 Kotlin package。
-### Go 嵌套类型风格选项
+### Go 嵌套类型样式选项
-通过 `go_nested_type_style` 控制嵌套 message、enum 和 union 在 Go 中的命名方式:
+控制嵌套消息/枚举/联合类型的 Go 命名:
```protobuf
package payment;
@@ -217,16 +219,16 @@ message Envelope {
}
```
-可选值:
+**可选值:**
- `underscore`(默认):`Envelope_Payload`
- `camelcase`:`EnvelopePayload`
-同时设置时,命令行参数 `--go_nested_type_style` 会覆盖 Schema 选项。
+如果两者都设置,CLI 标志 `--go_nested_type_style` 会覆盖 Schema 选项。
-### Swift 命名空间风格选项
+### Swift 命名空间样式选项
-通过 `swift_namespace_style` 控制 package 命名空间在 Swift 生成类型名称中的呈现方式:
+控制包命名空间如何反映在 Swift 生成的类型名称中:
```protobuf
package payment.v1;
@@ -237,18 +239,20 @@ message Payment {
}
```
-可选值:
+**可选值:**
-- `enum`(默认):使用命名空间包装类型,例如 `Payment.V1.Payment`
-- `flatten`:为顶层类型添加 package 前缀,例如 `Payment_V1_Payment`
+- `enum`(默认):命名空间包装器(例如 `Payment.V1.Payment`)
+- `flatten`:为顶层类型添加 package 前缀(例如 `Payment_V1_Payment`)
-**注意:** 仅当 package 非空时才应用命名空间包装或前缀。package 为空时,两种风格都直接生成顶层类型。
+**重要:**命名空间包装器/前缀仅在包非空时应用。如果包为空,Swift 会直接为两种样式发出顶级类型。
-同时设置时,命令行参数 `--swift_namespace_style` 会覆盖 Schema 选项。
+如果两者都设置,CLI 标志 `--swift_namespace_style` 会覆盖 Schema 选项。
### Rust Chrono 时间类型选项
-Rust 生成代码默认使用 Fory 的轻量时间载体类型:`fory::Date`、`fory::Timestamp` 和 `fory::Duration`。如果生成的 Rust API 需要改为暴露 chrono 时间类型,可设置 `rust_use_chrono_temporal_types`:
+Rust 生成的代码默认使用 Fory 的轻量级时间载体类型:
+`fory::Date`、`fory::Timestamp` 和 `fory::Duration`。如果生成的 Rust API
+需要公开 chrono 时间类型,请设置 `rust_use_chrono_temporal_types`:
```protobuf
package payment;
@@ -261,11 +265,13 @@ message Event {
}
```
-启用后,Rust 代码将 `date` 映射为 `chrono::NaiveDate`,将 `timestamp` 映射为 `chrono::NaiveDateTime`,将 `duration` 映射为 `chrono::Duration`。编译生成代码的 Rust crate 必须依赖 `chrono`,并启用 Fory 的 `chrono` feature。
+启用此选项后,Rust 代码会将 `date` 映射为 `chrono::NaiveDate`,将 `timestamp`
+映射为 `chrono::NaiveDateTime`,并将 `duration` 映射为 `chrono::Duration`。
+编译生成代码的 Rust crate 必须依赖 `chrono`,并启用 Fory 的 `chrono` feature。
-### Java Outer Classname 选项
+### Java 外层类名选项
-将多个类型包装到一个外层类:
+生成所有类型作为单个外部包装类的内部类:
```protobuf
package payment;
@@ -282,14 +288,14 @@ message Payment {
}
```
-效果:
+**影响:**
-- 生成单个 `DescriptorProtos.java`,而不是为每种类型生成独立文件
-- 所有 enum 和 message 都成为 `public static` 内部类
-- 外层类为带私有构造函数的 `public final` 类
-- 适合将相关类型组织在一起
+- 生成单个文件 `DescriptorProtos.java` 而不是单独的文件
+- 所有枚举和消息成为 `public static` 内部类
+- 外部类是带有私有构造函数的 `public final`
+- 用于将相关类型分组在一起
-生成结构:
+**生成的结构:**
```java
public final class DescriptorProtos {
@@ -308,7 +314,7 @@ public final class DescriptorProtos {
}
```
-与 `java_package` 组合使用:
+**与java_package结合使用:**
```protobuf
package payment;
@@ -320,11 +326,11 @@ message Payment {
}
```
-这会生成 `com/example/proto/PaymentProtos.java`,其中所有类型均为内部类。
+这会生成 `com/example/proto/PaymentProtos.java`,所有类型都作为内部类。
-### Java Multiple Files 选项
+### Java 多文件选项
-控制 Java 是否拆分多文件:
+控制类型是在单独的文件中生成还是作为内部类生成:
```protobuf
package payment;
@@ -340,28 +346,28 @@ message Receipt {
}
```
-行为:
+**行为:**
-| `java_outer_classname` | `java_multiple_files` | 结果 |
-| ---------------------- | --------------------- | ---------------- |
-| 未设置 | 任意 | 每个类型一个文件 |
-| 已设置 | `false`(默认) | 单文件 + 内部类 |
-| 已设置 | `true` | 强制拆分为多文件 |
+| `java_outer_classname` | `java_multiple_files` | 结果 |
+| ---------------------- | --------------------- | ---------------------------- |
+| 未设置 | 任何 | 单独的文件(每种类型一个) |
+| 放 | `false`(默认) | 所有类型作为内部类的单个文件 |
+| 放 | `true` | 单独的文件(覆盖外部类) |
-`java_multiple_files = true` 的效果:
+**`java_multiple_files = true`的效果:**
-- 每个顶层 enum 和 message 都有独立的 `.java` 文件
-- 覆盖 `java_outer_classname` 的行为
-- 适用于希望拆分文件、但仍需为其他用途指定外层类名的场景
+- 每个顶级枚举和消息都有自己的 `.java` 文件
+- 覆盖 `java_outer_classname` 行为
+- 当您想要单独的文件但仍为其他目的指定外部类名称时很有用
-未配置 `java_multiple_files`(默认):
+**没有 java_multiple_files 的示例(默认):**
```protobuf
option java_outer_classname = "PaymentProtos";
// Generates: PaymentProtos.java containing Payment and Receipt as inner classes
```
-配置 `java_multiple_files = true`:
+**java_multiple_files = true 的示例:**
```protobuf
option java_outer_classname = "PaymentProtos";
@@ -369,7 +375,9 @@ option java_multiple_files = true;
// Generates: Payment.java, Receipt.java (separate files)
```
-### 多个选项组合
+### 多个选项
+
+可以指定多个选项:
```protobuf
package payment;
@@ -382,36 +390,39 @@ message Payment {
}
```
-### Protobuf 扩展语法说明
+### Protobuf 扩展语法
-在 `.fdl` 中请只使用 Fory IDL 原生语法(如 `[id=100]`、`ref`、`optional`、`nullable=true`)。
+在 `.fdl` 文件中,仅使用 Fory IDL 原生语法(例如,`[id=100]`、`ref`、
+`optional`、`nullable=true`)。
-带 `(fory).` 的 Protobuf 扩展语法仅用于 `.proto` 文件和 Protobuf 前端。
+`(fory).` Protobuf 扩展语法仅适用于 `.proto` 文件和 protobuf 前端。
-Protobuf 扩展选项详见 [Protocol Buffers IDL Support](protobuf-idl.md#fory-extension-options-protobuf)。
+有关 protobuf 扩展选项,请参阅
+[协议缓冲区 IDL 支持](protobuf-idl.md#fory-extension-options-protobuf)。
### 选项优先级
-特定语言的 package 或命名空间按以下优先级确定:
+对于特定于语言的包/命名空间:
-1. 特定语言选项(`java_package`、`go_package`、`csharp_namespace`、`kotlin_package`)
-2. Fory IDL package 声明(兜底)
+1. 特定语言的选项(`java_package`、`go_package`、`csharp_namespace`、
+ `kotlin_package`)
+2. Fory IDL package 声明(回退选项)
-示例:
+**例子:**
```protobuf
package myapp.models;
option java_package = "com.example.generated";
```
-| 场景 | 使用的 Java package |
-| ----------------------- | ------------------------------ |
-| 配置 `java_package` | `com.example.generated` |
-| 未配置 `java_package` | `myapp.models`(兜底) |
+| 场景 | 使用的 Java 包 |
+| --------------------- | ----------------------- |
+| 存在 `java_package` | `com.example.generated` |
+| 不存在 `java_package` | `myapp.models`(回退) |
### 跨语言类型注册
-特定语言选项只影响代码生成位置,不改变序列化时使用的类型命名空间,从而保证跨语言兼容性:
+特定于语言的选项仅影响代码的生成位置,而不影响用于序列化的类型命名空间。这确保了跨语言兼容性:
```protobuf
package myapp.models;
@@ -423,15 +434,15 @@ message User {
}
```
-所有语言都使用命名空间 `myapp.models` 注册 `User`,因此支持:
+所有语言都将注册 `User`,并使用命名空间 `myapp.models`,从而实现:
-- Java 序列化的数据由 Go 反序列化
-- Go 序列化的数据由 Java 反序列化
-- 任意语言组合都可以无缝互操作
+- Java序列化数据→Go反序列化
+- Go序列化数据→Java反序列化
+- 任何语言组合均可无缝运行
## Import 语句
-`import` 语句用于引用其他 Fory IDL 文件中定义的类型。
+Import 语句允许您使用其他 Fory IDL 文件中定义的类型。
### 基本语法
@@ -439,7 +450,7 @@ message User {
import "path/to/file.fdl";
```
-### 多个导入
+### 多个 Import
```protobuf
import "common/types.fdl";
@@ -449,7 +460,7 @@ import "models/address.fdl";
### 路径解析
-`import` 路径相对于发起导入的文件解析:
+导入路径是相对于导入文件解析的:
```
project/
@@ -461,17 +472,17 @@ project/
└── main.fdl # import "common/types.fdl"
```
-规则:
+**规则:**
-- import path 是使用单引号或双引号包围的字符串
-- path 相对于发起导入的文件所在目录解析
-- 导入的类型与当前文件中定义的类型一样可用
-- 编译器会检测循环导入并报告错误
-- 支持传递导入:若 A 导入 B、B 导入 C,则 A 可以使用 C 的类型
+- 导入路径是带引号的字符串(双引号或单引号)
+- 路径相对于导入文件的目录进行解析
+- 导入的类型变得可用,就像在当前文件中定义的一样
+- 循环导入被检测并报告为错误
+- 传递导入有效(如果 A 导入 B 并且 B 导入 C,则 A 可以访问 C 的类型)
### 完整示例
-**common/types.fdl:**
+**常见/类型.fdl:**
```protobuf
package common;
@@ -489,7 +500,7 @@ message Address [id=101] {
}
```
-**models/user.fdl:**
+**模型/user.fdl:**
```protobuf
package models;
@@ -503,9 +514,9 @@ message User [id=200] {
}
```
-### 不支持的 import 写法
+### 不支持的导入语法
-不支持以下 Protobuf import 修饰符:
+**不支持**以下 protobuf 导入修饰符:
```protobuf
// NOT SUPPORTED - will produce an error
@@ -513,22 +524,22 @@ import public "other.fdl";
import weak "other.fdl";
```
-**`import public`:** Fory IDL 使用更简单的导入模型。导入的类型只对发起导入的文件可见,不支持重新导出;请在需要的位置直接导入各文件。
+**`import public`**:Fory IDL 使用更简单的导入模型。所有导入的类型仅适用于导入文件。不支持重新导出。在需要的地方直接导入每个文件。
-**`import weak`:** Fory IDL 要求编译时所有导入文件都存在,不支持可选依赖。
+**`import weak`**:Fory IDL 要求所有导入在编译时都存在。不支持可选依赖项。
-### import 错误
+### 导入错误
-编译器会报告以下错误:
+编译器报告错误:
-- **文件不存在:** 找不到导入文件
-- **循环导入:** A 直接或间接导入 B,而 B 又导入 A
-- **解析错误:** 导入文件存在语法错误
-- **不支持的语法:** 使用 `import public` 或 `import weak`
+- **文件未找到**:导入的文件不存在
+- **循环导入**:A 导入 B,B 又导入 A(直接或间接)
+- **解析错误**:导入文件中的语法错误
+- **不支持的语法**:`import public` 或 `import weak`
-## Enum 定义
+## 枚举定义
-enum 定义一组具名整数常量。
+枚举定义一组命名整数常量。
### 基本语法
@@ -540,7 +551,7 @@ enum Status {
}
```
-### 显式类型 ID
+### 使用显式类型 ID
```protobuf
enum Status [id=100] {
@@ -550,7 +561,9 @@ enum Status [id=100] {
}
```
-### 预留值
+### 保留值
+
+保留字段编号或名称以防止重复使用:
```protobuf
enum Status {
@@ -562,9 +575,9 @@ enum Status {
}
```
-### enum 类型选项
+### 枚举类型选项
-enum 级选项写在 enum 名称后的 `[]` 中:
+枚举级选项在枚举名称之后的 `[]` 中内联声明:
```protobuf
enum Status [deprecated=true] {
@@ -573,29 +586,31 @@ enum Status [deprecated=true] {
}
```
-FDL 不支持在 enum 内部使用 `option ...;` 语句。
+FDL 不支持枚举体内的 `option ...;` 语句。
-不支持 `allow_alias`;同一个 enum 中每个枚举值必须使用不同的整数。
+**不支持:**
+
+- **不支持** `allow_alias`。每个枚举值必须有一个唯一的整数。
### 语言映射
-| 语言 | 实现形式 |
+| 语言 | 执行 |
| --------------------- | -------------------------------------- |
| Java | `enum Status { UNKNOWN, ACTIVE, ... }` |
| Python | `class Status(IntEnum): UNKNOWN = 0` |
-| Go | `type Status int32` 配合常量 |
+| Go | `type Status int32` 带常数 |
| Rust | `#[repr(i32)] enum Status { Unknown }` |
| C++ | `enum class Status : int32_t { ... }` |
| C# | `enum Status { Unknown, Active, ... }` |
| JavaScript/TypeScript | `export enum Status { UNKNOWN, ... }` |
-| Swift | 使用稳定 ID 的 `enum Status` |
+| Swift | `enum Status` 具有稳定的 ID |
| Dart | `enum Status { unknown, active, ... }` |
| Scala | Scala 3 `enum Status` |
| Kotlin | `enum class Status` |
-### 枚举前缀处理
+### 枚举前缀剥离
-如果枚举值使用 Protobuf 风格前缀(枚举名称的大写蛇形形式),编译器会为具有作用域 enum 的语言自动去除该前缀:
+当枚举值使用 protobuf 样式前缀(UPPER_SNAKE_CASE 中的枚举名称)时,编译器会自动删除具有范围枚举的语言的前缀:
```protobuf
// Input with prefix
@@ -606,23 +621,25 @@ enum DeviceTier {
}
```
-| 语言 | 输出示例 | 风格 |
-| --------------------- | ----------------------------------------- | ---------------- |
-| Java | `UNKNOWN, TIER1, TIER2` | 作用域枚举 |
-| Rust | `Unknown, Tier1, Tier2` | 作用域枚举 |
-| C++ | `UNKNOWN, TIER1, TIER2` | 作用域枚举 |
-| Python | `UNKNOWN, TIER1, TIER2` | 作用域 `IntEnum` |
-| Go | `DeviceTierUnknown, DeviceTierTier1, ...` | 非作用域常量 |
-| JavaScript/TypeScript | `UNKNOWN, TIER1, TIER2` | 作用域枚举 |
-| C# | `Unknown, Tier1, Tier2` | 作用域枚举 |
-| Swift | `unknown, tier1, tier2` | 作用域枚举 |
-| Dart | `unknown, tier1, tier2` | 作用域枚举 |
-| Scala | `Unknown, Tier1, Tier2` | 作用域枚举 |
-| Kotlin | `UNKNOWN, TIER1, TIER2` | 作用域枚举 |
+**生成的代码:**
+
+| 语言 | 输出 | 风格 |
+| --------------------- | ----------------------------------------- | ------------ |
+| Java | `UNKNOWN, TIER1, TIER2` | 作用域枚举 |
+| Rust | `Unknown, Tier1, Tier2` | 作用域枚举 |
+| C++ | `UNKNOWN, TIER1, TIER2` | 作用域枚举 |
+| Python | `UNKNOWN, TIER1, TIER2` | 范围内枚举 |
+| Go | `DeviceTierUnknown, DeviceTierTier1, ...` | 无作用域常量 |
+| JavaScript/TypeScript | `UNKNOWN, TIER1, TIER2` | 作用域枚举 |
+| C# | `Unknown, Tier1, Tier2` | 作用域枚举 |
+| Swift | `unknown, tier1, tier2` | 作用域枚举 |
+| Dart | `unknown, tier1, tier2` | 作用域枚举 |
+| Scala | `Unknown, Tier1, Tier2` | 作用域枚举 |
+| Kotlin | `UNKNOWN, TIER1, TIER2` | 作用域枚举 |
-仅当去除前缀后的内容是合法标识符时才会执行。例如,`DEVICE_TIER_1` 会保持不变,因为 `1` 不是合法标识符。
+**注意:** 仅当其余部分是有效标识符时才会删除前缀。例如,`DEVICE_TIER_1` 保持不变,因为 `1` 不是有效的标识符名称。
-语法:
+**语法:**
```
enum_def := 'enum' IDENTIFIER [type_options] '{' enum_body '}'
@@ -633,14 +650,14 @@ reserved_stmt := 'reserved' reserved_items ';'
enum_value := IDENTIFIER '=' INTEGER ';'
```
-规则:
+**规则:**
-- enum 名称在文件中必须唯一
-- 每个枚举值都必须显式指定整数
-- 同一个 enum 中的整数值必须唯一,不允许别名
-- enum 的类型 ID(`[id=100]`)是可选的,但建议在跨语言场景中使用
+- 枚举名称在文件中必须是唯一的
+- 枚举值必须具有显式整数赋值
+- 值整数在枚举中必须是唯一的(无别名)
+- 类型 ID (`[id=100]`) 对于枚举来说是可选的,但建议跨语言使用
-完整示例:
+**具有所有功能的示例:**
```protobuf
// HTTP status code categories
@@ -655,9 +672,9 @@ enum HttpCategory [id=200] {
}
```
-## Message 定义
+## 消息定义
-message 定义包含带类型字段的结构化数据类型。
+消息使用类型化字段定义结构化数据类型。
### 基本语法
@@ -668,7 +685,7 @@ message Person {
}
```
-### 显式类型 ID
+### 使用显式类型 ID
```protobuf
message Person [id=101] {
@@ -677,7 +694,7 @@ message Person [id=101] {
}
```
-### 无显式类型 ID
+### 不使用显式类型 ID
```protobuf
message Person { // Auto-generated when enable_auto_type_id = true
@@ -688,23 +705,26 @@ message Person { // Auto-generated when enable_auto_type_id = true
### 语言映射
-| 语言 | 实现形式 |
-| --------------------- | ---------------------------------- |
-| Java | 带 getter/setter 的 POJO |
-| Python | `@dataclass` 类 |
-| Go | 包含导出字段的 struct |
-| Rust | 带 `#[derive(ForyStruct)]` 的 struct |
-| C++ | 带 `FORY_STRUCT` 宏的 struct |
-| C# | 带 `[ForyStruct]` 的类 |
-| JavaScript/TypeScript | `export interface` 声明 |
-| Swift | `@ForyStruct` struct 或 class |
-| Dart | `@ForyStruct` `final class` |
-| Scala | Scala 3 `case class` 或 class |
-| Kotlin | `data class` 或 class |
+| 语言 | 执行 |
+| --------------------- | ------------------------------ |
+| Java | 带有 getter/setter 的 POJO 类 |
+| Python | `@dataclass`级 |
+| Go | 具有导出字段的结构 |
+| Rust | 结构为 `#[derive(ForyStruct)]` |
+| C++ | 具有 `FORY_STRUCT` 宏的结构 |
+| C# | `[ForyStruct]`级 |
+| JavaScript/TypeScript | `export interface`声明 |
+| Swift | `@ForyStruct` 结构或类 |
+| Dart | `@ForyStruct` `final class` |
+| Scala | Scala 3 `case class` 或类 |
+| Kotlin | `data class`或类 |
-类型 ID 控制 message、union 和 enum 的跨语言注册。自动生成、alias 和冲突处理详见 [类型 ID](#type-ids)。
+类型 ID 控制消息、联合和枚举的跨语言注册。看
+[类型 ID](#type-ids) 用于自动生成、别名和冲突处理。
-### 预留字段
+### 保留字段
+
+保留字段编号或名称以防止删除字段后重复使用:
```protobuf
message User {
@@ -715,9 +735,9 @@ message User {
}
```
-### message 类型选项
+### 消息类型选项
-message 级选项写在 message 名称后的 `[]` 中:
+消息级选项在消息名称之后的 `[]` 中内联声明:
```protobuf
message User [deprecated=true] {
@@ -726,9 +746,9 @@ message User [deprecated=true] {
}
```
-FDL 不支持在 message 或 enum 内部使用 `option ...;` 语句。
+FDL 不支持消息或枚举主体内的 `option ...;` 语句。
-语法:
+**语法:**
```
message_def := 'message' IDENTIFIER [type_options] '{' message_body '}'
@@ -738,13 +758,15 @@ message_body := (reserved_stmt | nested_type | field_def)*
nested_type := enum_def | message_def | union_def
```
-类型 ID 遵循 [类型 ID](#type-ids) 中的规则。
+**规则:**
+
+- 类型 ID 遵循[类型 ID](#type-ids) 中的规则。
## 嵌套类型
-message 可以包含嵌套的 message、enum 和 union,适合定义与父 message 紧密相关的类型。
+消息可以包含嵌套消息、枚举和联合定义。这对于定义与其父消息密切相关的类型非常有用。
-### 嵌套 message
+### 嵌套消息
```protobuf
message SearchResponse {
@@ -757,7 +779,7 @@ message SearchResponse {
}
```
-### 嵌套 enum
+### 嵌套枚举
```protobuf
message Container {
@@ -770,9 +792,9 @@ message Container {
}
```
-### 限定类型名
+### 限定类型名称
-其他 message 可以通过限定名称(`Parent.Child`)引用嵌套类型:
+可以使用限定名称 (Parent.Child) 从其他消息引用嵌套类型:
```protobuf
message SearchResponse {
@@ -789,9 +811,9 @@ message SearchResultCache {
}
```
-### 深层嵌套类型
+### 深度嵌套类型
-嵌套可以有多层:
+嵌套可以是多层深度:
```protobuf
message Outer {
@@ -810,35 +832,35 @@ message OtherMessage {
}
```
-### 各语言生成形态
+### 特定语言的生成
-| 语言 | 嵌套类型生成方式 |
-| --------------------- | ---------------------------------------------------------------------------- |
-| Java | 静态内部类(`SearchResponse.Result`) |
-| Python | dataclass 中的嵌套类 |
-| Go | 下划线连接的扁平 struct(`SearchResponse_Result`,可配置为 camelcase) |
-| Rust | 嵌套模块(`search_response::Result`) |
-| C++ | 嵌套类(`SearchResponse::Result`) |
-| C# | 嵌套类(`SearchResponse.Result`) |
-| JavaScript/TypeScript | 扁平名称(`Result`) |
-| Swift | 嵌套命名空间包装类型或扁平名称 |
-| Dart | 带下划线的扁平类(`SearchResponse_Result`) |
-| Scala | 嵌套 companion/object 作用域 |
-| Kotlin | 扁平的生成名称 |
+| 语言 | 嵌套类型生成 |
+| --------------------- | ------------------------------------------------------------- |
+| Java | 静态内部类(`SearchResponse.Result`) |
+| Python | 数据类中的嵌套类 |
+| Go | 带下划线的平面结构(`SearchResponse_Result`,可配置为驼峰式) |
+| Rust | 嵌套模块(`search_response::Result`) |
+| C++ | 嵌套类(`SearchResponse::Result`) |
+| C# | 嵌套类(`SearchResponse.Result`) |
+| JavaScript/TypeScript | 单位名称 (`Result`) |
+| Swift | 嵌套命名空间包装器或扁平化名称 |
+| Dart | 带下划线的扁平类(`SearchResponse_Result`) |
+| Scala | 嵌套 companion/object 作用域 |
+| Kotlin | 平面生成的名称 |
-Go 默认使用下划线分隔嵌套名称;设置 `option go_nested_type_style = "camelcase";` 可改为拼接名称。Rust 会为嵌套类型生成嵌套模块。
+**注意:**Go 默认使用下划线分隔嵌套名称;设置 `option go_nested_type_style = "camelcase";` 可使用拼接名称。Rust 会为嵌套类型生成嵌套模块。
-### 嵌套规则
+### 嵌套类型规则
-- 嵌套类型名在其父作用域内必须唯一
-- 嵌套类型可以拥有自己的类型 ID
-- 数字类型 ID 必须全局唯一,包括嵌套类型;自动生成和冲突处理详见 [类型 ID](#type-ids)
-- 在一个 message 内,可以使用简单名称引用其中的嵌套类型
-- 在 message 外部,使用限定名称(`Parent.Child`)
+- 嵌套类型名称在其父消息中必须是唯一的
+- 嵌套类型可以有自己的类型 ID
+- 数字类型 ID 必须全局唯一(包括嵌套类型);自动生成和冲突处理请参阅[类型 ID](#type-ids)
+- 在消息中,您可以通过简单名称引用嵌套类型
+- 从外部引用时,使用限定名称(Parent.Child)
-## Union 定义
+## 联合定义
-union 表示同一时间只保存多个 case 类型之一的值。
+联合类型定义一个值,该值只能包含多个 case 类型中的一个。
### 基本语法
@@ -849,7 +871,7 @@ union Animal [id=106] {
}
```
-### 在 message 中使用 union
+### 在消息中使用联合
```protobuf
message Person [id=100] {
@@ -860,23 +882,27 @@ message Person [id=100] {
### 规则
-- case ID 必须非负,且在 union 中唯一
-- 特定语言的 unknown-case 标记只用于选择承载类型,不会向 Schema case 表中增加条目
-- case 不能使用 `optional` 或 `ref`
-- union case 支持载荷元数据对应的字段选项,例如标量编码和集合元素元数据
-- case 类型可以是基本类型、enum、message 或其他具名类型
-- union 类型 ID 遵循 [类型 ID](#type-ids) 中的规则
+- case ID 必须为非负数,并且在联合类型中唯一
+- 特定语言的未知 case 标记只选择前向兼容载体,不会在 Schema case 表中新增条目
+- case 不能是 `optional` 或 `ref`
+- 联合 case 支持载荷元数据的字段选项,例如标量编码
+ 和集合元素元数据
+- Case 类型可以是基本类型、枚举、消息或其他命名类型
+- 联合类型 ID 遵循 [类型 ID](#type-ids) 中的规则。
-语法:
+**语法:**
```
union_def := 'union' IDENTIFIER [type_options] '{' union_field* '}'
union_field := ['repeated'] field_type IDENTIFIER '=' INTEGER [field_options] ';'
```
-## Service 定义
+## 服务定义 {#service-definition}
-service 在 Fory IDL 中定义远程过程调用(RPC)方法契约。service 是可选的:包含 service 的 Schema 仍会生成常规数据模型类型;仅当编译器为 Java、Python、Go、Rust、C#、Dart、Scala、Kotlin 和 JavaScript 等受支持语言运行时传入 `--grpc`,才生成 gRPC service 代码。JavaScript 浏览器端 gRPC-Web client 通过 `--grpc-web` 生成。
+服务用于在 Fory IDL 中定义 RPC 方法契约。服务定义是可选的:即使 Schema 包含服务,
+也仍会生成常规数据模型类型。只有为 Java、Python、Go、Rust、C#、Dart、Scala、Kotlin 或
+JavaScript 等受支持目标使用 `--grpc` 运行编译器时,才会额外生成 gRPC 服务代码。
+JavaScript 浏览器 gRPC-Web 客户端使用 `--grpc-web` 生成。
```protobuf
message GetPetRequest [id=200] {
@@ -894,11 +920,11 @@ service PetDirectory {
}
```
-第一个方法使用 message 作为请求和响应类型;第二个方法直接使用 union 作为请求和响应类型,Fory IDL 支持这种用法。
+第一个方法使用消息作为请求和响应类型。第二个方法展示 Fory IDL 对直接使用联合类型作为请求和响应类型的支持。
-### Streaming RPC
+### 流式 RPC
-在请求类型、响应类型或两者之前加上 `stream`:
+在请求类型、响应类型或两者之前使用 `stream`:
```protobuf
service PetDirectory {
@@ -911,11 +937,16 @@ service PetDirectory {
### RPC 类型规则
-- 请求和响应类型必须引用具名 message 或 union 类型。
-- enum、基本类型、collection、map 和 array 不能直接作为 RPC 请求或响应类型。在 service 契约需要这些值时,请用 message 包装。
-- 生成的 gRPC 配套代码使用 Fory 序列化每个 RPC 载荷。编译或运行这些配套代码的应用需自行提供 gRPC 依赖,例如 grpc-java、grpc-kotlin、`grpcio`、grpc-go、Rust `tonic` 与 `bytes`、Scala grpc-java API、`@grpc/grpc-js`、`grpc-web`、C# `Grpc.Core.Api` 加 server 或 client package,以及 Dart `package:grpc`。Python 配套代码默认使用 `grpc.aio`,也可通过 `--grpc-python-mode=sync` 生成同步模式代码。
+- 请求和响应类型必须引用命名消息或联合类型。
+- 枚举、基本类型、集合、Map 和数组不能直接作为 RPC 请求或响应类型。在服务契约中使用这些值时,请将其包装在消息中。
+- 生成的 gRPC 配套代码使用 Fory 序列化每个 RPC 载荷。
+ 编译或运行这些配套代码的应用需要自行提供 gRPC
+ 依赖项,例如 grpc-java、grpc-kotlin、`grpcio`、grpc-go、Rust `tonic`
+ 和 `bytes`、Scala grpc-java API、`@grpc/grpc-js`、`grpc-web`、C#
+ `Grpc.Core.Api` 及服务端或客户端软件包,或 Dart `package:grpc`。Python
+ 配套代码默认使用 `grpc.aio`;通过 `--grpc-python-mode=sync` 也可生成同步模式代码。
-语法:
+**语法:**
```
service_def := 'service' IDENTIFIER '{' rpc_method* '}'
@@ -925,7 +956,7 @@ rpc_method := 'rpc' IDENTIFIER '(' ['stream'] named_type ')'
## 字段定义
-字段定义 message 的属性。
+字段定义消息的属性。
### 基本语法
@@ -933,7 +964,7 @@ rpc_method := 'rpc' IDENTIFIER '(' ['stream'] named_type ')'
field_type field_name = field_number;
```
-### 带修饰符语法
+### 带修饰符
```protobuf
optional list<string> tags = 1; // Nullable list
@@ -941,7 +972,7 @@ list<optional string> tags = 2; // Elements may be null
list<ref Node> nodes = 3; // Elements tracked as references
```
-语法:
+**语法:**
```
field_def := [modifiers] field_type IDENTIFIER '=' INTEGER ';'
@@ -951,16 +982,17 @@ list_type := 'list' '<' { 'optional' | 'ref' | scalar_encoding } field_type '
array_type := 'array' '<' array_element_type '>'
```
-`list` 前的 `optional` 作用于集合字段。不能将 `optional` 直接用于 `any`;
-应使用 `any`、`list<any>` 或 `map<K, any>`,不要使用 `optional any`、
-`list<optional any>` 或 `map<K, optional any>`。`ref` 只适用于具名的 message/union
-字段;集合内容应使用 `list<ref T>` 或 `map<K, ref V>`。`repeated` 是 `list` 的别名。
+`optional` 位于 `list` 之前时作用于集合字段。不能将 `optional` 直接应用于
+`any`;请使用 `any`、`list<any>` 或 `map<K, any>`,不要使用 `optional any`、
+`list<optional any>` 或 `map<K, optional any>`。`ref` 仅适用于具名 message/union
+字段;对于集合内容,请使用 `list<ref T>` 或 `map<K, ref V>`。`repeated` 可作为
+`list` 的别名。
-### 字段修饰符
+### 字段修饰符 {#field-modifiers}
#### `optional`
-将字段标记为可空:
+将字段标记为可为空:
```protobuf
message User {
@@ -969,13 +1001,13 @@ message User {
}
```
-不要将 `optional` 或 `[nullable = true]` 直接用于 `any`。编译器会拒绝
-`optional any`、`any [nullable = true]`、`list<optional any>` 和
+请勿直接使用 `optional` 或 `[nullable = true]` 修饰 `any`。编译器
+拒绝 `optional any`、`any [nullable = true]`、`list<optional any>` 和
`map<K, optional any>`;请改用 `any`、`list<any>` 或 `map<K, any>`。
-**生成代码:**
+**生成的代码:**
-| 语言 | 非 optional | optional |
+| 语言 | 非可选 | 选修的 |
| --------------------- | ------------------ | --------------------------------- |
| Java | `String name` | `@Nullable String email` |
| Python | `name: str` | `name: Optional[str]` |
@@ -989,16 +1021,16 @@ message User {
| Scala | `name: String` | `email: Option[String]` |
| Kotlin | `name: String` | `email: String?` |
-默认值:
+**默认值:**
-| 类型 | 默认值 |
-| ----------------- | --------------------- |
-| 非 optional 类型 | 对应语言的默认值 |
-| optional 类型 | `null`/`None`/`nil` |
+| 类型 | 默认值 |
+| ---------- | ------------------- |
+| 非可选类型 | 默认语言 |
+| 可选类型 | `null`/`None`/`nil` |
#### `ref`
-开启引用跟踪,用于共享对象与循环结构:
+启用共享/循环引用的引用跟踪:
```protobuf
message Node {
@@ -1008,33 +1040,36 @@ message Node {
}
```
-适用场景:
+**使用案例:**
- 共享对象(同一对象被多次引用)
-- 循环引用(存在环的对象图)
-- 带父节点指针的树形结构
-
-**生成代码:**
-
-| 语言 | 不使用 `ref` | 使用 `ref` |
-| --------------------- | ---------------- | ------------------------------------------- |
-| Java | `Node parent` | 带 `@Ref` 的 `Node parent` |
-| Python | `parent: Node` | `parent: Node = pyfory.field(ref=True)` |
-| Go | `Parent Node` | 带 `fory:"ref"` 的 `Parent *Node` |
-| Rust | `parent: Node` | `parent: Arc<Node>` |
-| C++ | `Node parent` | `std::shared_ptr<Node> parent` |
-| C# | `Node parent` | 启用引用跟踪的 `Node? parent` |
-| JavaScript/TypeScript | `parent: Node` | `parent: Node`(不区分 ref) |
-| Swift | `Node parent` | 启用引用跟踪的 class reference |
-| Dart | `Node parent` | 带 `@ForyField(ref: true)` 的 `Node parent` |
-| Scala | `parent: Node` | `@Ref parent: Node` |
-| Kotlin | `parent: Node` | `@Ref parent: Node?` |
-
-Rust 对启用引用跟踪的字段默认使用 `Arc` 和 `ArcWeak`。生成的 Rust 类型必须使用单线程 `Rc` 或 `RcWeak` 承载类型时,可配置 `ref(thread_safe=false)`。该设置只影响 Rust 代码生成所选的承载类型,不改变编码格式,也不会使被引用值本身具备线程安全性。Protobuf 选项语法详见 [Protocol Buffers IDL Support](protobuf-idl.md#field-level-options)。
-
-Rust 指针承载类型映射:
-
-| Fory IDL | Rust type |
+- 循环引用(带有循环的对象图)
+- 具有父指针的树结构
+
+**生成的代码:**
+
+| 语言 | 不带`ref` | 配`ref` |
+| --------------------- | -------------- | ----------------------------------------- |
+| Java | `Node parent` | `Node parent`,带 `@Ref` |
+| Python | `parent: Node` | `parent: Node = pyfory.field(ref=True)` |
+| Go | `Parent Node` | `Parent *Node`,带 `fory:"ref"` |
+| Rust | `parent: Node` | `parent: Arc<Node>` |
+| C++ | `Node parent` | `std::shared_ptr<Node> parent` |
+| C# | `Node parent` | 带引用跟踪的 `Node? parent` |
+| JavaScript/TypeScript | `parent: Node` | `parent: Node`(不区分 ref) |
+| Swift | `Node parent` | 带引用跟踪的类引用 |
+| Dart | `Node parent` | `Node parent`,带 `@ForyField(ref: true)` |
+| Scala | `parent: Node` | `@Ref parent: Node` |
+| Kotlin | `parent: Node` | `@Ref parent: Node?` |
+
+Rust 默认对引用跟踪字段使用 `Arc` 和 `ArcWeak`。设置 `ref(thread_safe=false)` 后,
+生成的 Rust 类型将改用单线程 `Rc` 或 `RcWeak` 载体。该设置只选择 Rust 代码生成
+使用的载体;它不会改变 wire format,也不会使被引用的值本身变为线程安全。
+protobuf 选项语法参见 [Protocol Buffers IDL 支持](protobuf-idl.md#field-level-options)。
+
+Rust 指针载体映射:
+
+| Fory IDL | Rust 类型 |
| ----------------------------------------------- | --------------- |
| `ref Node parent` | `Arc<Node>` |
| `ref(thread_safe=false) Node parent` | `Rc<Node>` |
@@ -1052,7 +1087,7 @@ message Document {
}
```
-**生成代码:**
+**生成的代码:**
| 语言 | 类型 |
| --------------------- | -------------------------- |
@@ -1070,7 +1105,7 @@ message Document {
### 组合修饰符
-修饰符可以组合使用:
+修饰符可以组合:
```fdl
message Example {
@@ -1081,21 +1116,24 @@ message Example {
}
```
-`list` 前的 `optional` 作用于字段或集合本身。不能在 `list` 或 `map` 前使用 `ref`;应将 `ref` 放在元素或 value 类型中。`repeated` 是 `list` 的别名。
+`optional` 位于 `list` 之前时作用于字段/集合。`ref` 不能位于 `list` 或 `map`
+之前;请将 `ref` 放入元素类型或值类型中。`repeated` 可作为 `list` 的别名。
-List 修饰符映射:
+**列表修饰符映射:**
-| Fory IDL | Java | Python | Go | Rust | C++ | Dart | Scala |
-| ----------------------- | ---------------------------------- | --------------------- | ----------------------- | --------------------- | ----------------------------------------- | ------------------------------------------------------------- | ---------------------- |
-| `optional list<string>` | `@Nullable List<String>` | `Optional[List[str]]` | `[]string` + `nullable` | `Option<Vec<String>>` | `std::optional<std::vector<std::string>>` | `List<String>?` | `Option[List[String]]` |
-| `list<optional string>` | `List<String>`(元素可空) | `List[Optional[str]]` | `[]*string` | `Vec<Option<String>>` | `std::vector<std::optional<std::string>>` | `List<String?>` | `List[Option[String]]` |
-| `list<ref User>` | `List<@Ref User>` | `List[User]` | `[]*User` + `ref=false` | `Vec<Arc<User>>` | `std::vector<std::shared_ptr<User>>` | `List<User>` + `@ListField(element: DeclaredType(ref: true))` | `List[User @Ref]` |
+| Fory IDL | Java | Python | Go | Rust | C++ | Dart | Scala |
+| ----------------------- | ---------------------------- | --------------------- | ----------------------- | --------------------- | ----------------------------------------- | ------------------------------------------------------------- | ---------------------- |
+| `optional list<string>` | `@Nullable List<String>` | `Optional[List[str]]` | `[]string` + `nullable` | `Option<Vec<String>>` | `std::optional<std::vector<std::string>>` | `List<String>?` | `Option[List[String]]` |
+| `list<optional string>` | `List<String>`(可为空元素) | `List[Optional[str]]` | `[]*string` | `Vec<Option<String>>` | `std::vector<std::optional<std::string>>` | `List<String?>` | `List[Option[String]]` |
+| `list<ref User>` | `List<@Ref User>` | `List[User]` | `[]*User` + `ref=false` | `Vec<Arc<User>>` | `std::vector<std::shared_ptr<User>>` | `List<User>` + `@ListField(element: DeclaredType(ref: true))` | `List[User @Ref]` |
-在 Fory IDL 中使用 `ref(thread_safe=false)`(或在 Protobuf 中使用 `[(fory).thread_safe_pointer = false]`),可让 Rust 生成 `Rc` 而非 `Arc`。
+在 Fory IDL 中使用 `ref(thread_safe=false)`(或
+protobuf中的`[(fory).thread_safe_pointer = false]`)生成`Rc`而不是
+Rust 中的 `Arc`。
-## 字段号
+## 字段编号
-每个字段都必须有唯一的正整数标识符:
+每个字段必须有一个唯一的正整数标识符:
```protobuf
message Example {
@@ -1105,108 +1143,109 @@ message Example {
}
```
-规则与最佳实践:
-
-- 字段号在一个 message 内必须唯一。
-- 字段号必须是正整数。
-- 允许留出空号;删除字段后保留空号会很有用。
-- 建议从 `1` 开始顺序编号。
-- 不要把已删除字段的编号重新用于其他字段。
-
-## Type System {#type-system}
-
-Fory IDL 为基本类型、具名类型和集合提供跨语言类型系统。字段修饰符(`optional`、`ref`)控制可空性与引用跟踪,`list<T>` 和 `array<T>` 用于选择集合 Schema 类型(详见[字段修饰符](#字段修饰符))。
-
-本节的简表列出常见的生成承载类型。包括 C#、Swift、Dart、Scala 和 Kotlin 在内的完整 1.0 语言支持范围,请参阅[跨语言类型映射规范](../specification/xlang_type_mapping.md)。
-
-### Primitive Types
-
-| 类型 | 说明 | 大小 |
-| ----------- | ---------------------------------- | ------ |
-| `bool` | 布尔值 | 1 字节 |
-| `int8` | 8 位有符号整数 | 1 字节 |
-| `int16` | 16 位有符号整数 | 2 字节 |
-| `int32` | 32 位有符号整数,默认 varint | 4 字节 |
-| `int64` | 64 位有符号整数,默认 PVL varint | 8 字节 |
-| `uint8` | 8 位无符号整数 | 1 字节 |
-| `uint16` | 16 位无符号整数 | 2 字节 |
-| `uint32` | 32 位无符号整数,默认 varint | 4 字节 |
-| `uint64` | 64 位无符号整数,默认 PVL varint | 8 字节 |
-| `float16` | IEEE 754 binary16 浮点数 | 2 字节 |
-| `bfloat16` | Brain floating point | 2 字节 |
-| `float32` | 32 位浮点数 | 4 字节 |
-| `float64` | 64 位浮点数 | 8 字节 |
-| `string` | UTF-8 字符串 | 变长 |
-| `bytes` | 二进制数据 | 变长 |
-| `date` | 日历日期 | 变长 |
-| `timestamp` | 带时区的日期和时间 | 变长 |
-| `duration` | 时间间隔 | 变长 |
-| `decimal` | 十进制数值 | 变长 |
-| `any` | 动态值(具体类型) | 变长 |
-
-#### Boolean
-
-`bool` 表示布尔值。
-
-| 语言 | 类型 | 说明 |
-| ---------- | --------- | ---- |
-| Java | `boolean` / `Boolean` | 基本类型或装箱类型 |
-| Python | `bool` | |
-| Go | `bool` | |
-| Rust | `bool` | |
-| C++ | `bool` | |
-| JavaScript | `boolean` | |
-| Dart | `bool` | |
-
-#### Integer Types
-
-Fory IDL 提供定长有符号整数(32/64 位整数默认使用 varint 编码):
-
-| Fory IDL 类型 | 大小 | 范围 |
-| ------------- | ----- | ---------------- |
-| `int8` | 8 位 | -128 到 127 |
-| `int16` | 16 位 | -32,768 到 32,767 |
-| `int32` | 32 位 | -2^31 到 2^31 - 1 |
-| `int64` | 64 位 | -2^63 到 2^63 - 1 |
-
-**有符号整数映射:**
-
-| Fory IDL | Java | Python | Go | Rust | C++ | JavaScript | Dart |
-| -------- | ------- | -------------- | ------- | ----- | --------- | ------------------ | ------- |
-| `int8` | `byte` | `pyfory.Int8` | `int8` | `i8` | `int8_t` | `number` | `int` |
-| `int16` | `short` | `pyfory.Int16` | `int16` | `i16` | `int16_t` | `number` | `int` |
-| `int32` | `int` | `pyfory.Int32` | `int32` | `i32` | `int32_t` | `number` | `int` |
-| `int64` | `long` | `pyfory.Int64` | `int64` | `i64` | `int64_t` | `bigint \| number` | `Int64` |
-
-Fory IDL 也提供定长无符号整数(32/64 位整数默认使用 varint 编码):
-
-| Fory IDL | 大小 | 范围 |
-| -------- | ----- | -------------- |
-| `uint8` | 8 位 | 0 到 255 |
-| `uint16` | 16 位 | 0 到 65,535 |
-| `uint32` | 32 位 | 0 到 2^32 - 1 |
-| `uint64` | 64 位 | 0 到 2^64 - 1 |
-
-**无符号整数的语言映射:**
-
-| Fory IDL | Java | Python | Go | Rust | C++ | JavaScript | Dart |
-| -------- | ------- | --------------- | -------- | ----- | ---------- | ------------------ | -------- |
-| `uint8` | `short` | `pyfory.UInt8` | `uint8` | `u8` | `uint8_t` | `number` | `int` |
-| `uint16` | `int` | `pyfory.UInt16` | `uint16` | `u16` | `uint16_t` | `number` | `int` |
-| `uint32` | `long` | `pyfory.UInt32` | `uint32` | `u32` | `uint32_t` | `number` | `int` |
-| `uint64` | `long` | `pyfory.UInt64` | `uint64` | `u64` | `uint64_t` | `bigint \| number` | `Uint64` |
-
-#### Integer Encoding Modifiers
-
-Fory IDL 默认对 32/64 位整数使用变长编码。如需其他编码格式,请添加标量编码修饰符:
-
-| 修饰符 | 适用类型 | 说明 |
-| -------- | ------------------------------------ | ------------------ |
-| `varint` | `int32`、`int64`、`uint32`、`uint64` | 默认编码的显式写法 |
-| `fixed` | `int32`、`int64`、`uint32`、`uint64` | 定长小端序 |
-| `tagged` | `int64`、`uint64` | 带 tag 的 64 位编码 |
-
-修饰符属于标量类型表达式,因此可用在嵌套的 list 和 map 中:
+**规则和最佳实践:**
+
+- 消息中的数字必须是唯一的。
+- 数字必须是正整数。
+- 允许有间隙,并且在删除字段时很有用。
+- 优先选择从 `1` 开始的顺序编号。
+- 切勿将已删除的字段编号重复用于其他字段。
+
+## 类型系统 {#type-system}
+
+Fory IDL 为基本类型、命名类型和集合提供统一类型系统。字段修饰符(`optional`、`ref`)控制可空性和
+引用跟踪,而 `list<T>` 和 `array<T>` 用于选择集合 Schema 类型
+(参见[字段修饰符](#field-modifiers))。
+
+本节中的简表列出常见的生成载体。完整的 1.0 语言支持范围(包括 C#、Swift、Dart、Scala 和 Kotlin)请参见
+[xlang 类型映射规范](../specification/xlang_type_mapping.md)。
+
+### 基本类型
+
+| 类型 | 描述 | 尺寸 |
+| ----------- | ----------------------------------- | ------ |
+| `bool` | 布尔值 | 1 字节 |
+| `int8` | 有符号 8 位整数 | 1 字节 |
+| `int16` | 有符号 16 位整数 | 2 字节 |
+| `int32` | 有符号 32 位整数,默认为 varint | 4 字节 |
+| `int64` | 有符号 64 位整数,默认为 PVL varint | 8 字节 |
+| `uint8` | 无符号 8 位整数 | 1字节 |
+| `uint16` | 无符号 16 位整数 | 2 字节 |
+| `uint32` | 无符号 32 位整数,默认为 varint | 4 字节 |
+| `uint64` | 无符号 64 位整数,默认为 PVL varint | 8 字节 |
+| `float16` | IEEE 754 binary16 浮点 | 2 字节 |
+| `bfloat16` | Brain Floating Point | 2 字节 |
+| `float32` | 32 位浮点数 | 4 字节 |
+| `float64` | 64 位浮点数 | 8 字节 |
+| `string` | UTF-8 字符串 | 可变 |
+| `bytes` | 二进制数据 | 可变 |
+| `date` | 日历日期 | 可变 |
+| `timestamp` | 带时区的日期和时间 | 可变 |
+| `duration` | 时长 | 可变 |
+| `decimal` | 十进制值 | 可变 |
+| `any` | 动态值(具体类型) | 可变 |
+
+#### 布尔值
+
+| 语言 | 类型 | 说明 |
+| --------------------- | --------------------- | ---------- |
+| Java | `boolean` / `Boolean` | 基本或装箱 |
+| Python | `bool` | |
+| Go | `bool` | |
+| Rust | `bool` | |
+| C++ | `bool` | |
+| JavaScript/TypeScript | `boolean` | |
+| Dart | `bool` | |
+
+#### 整数类型
+
+Fory IDL 提供固定宽度有符号整数(32/64 位整数默认使用变长编码):
+
+| Fory IDL 类型 | 位宽 | 范围 |
+| ------------- | ----- | ----------------- |
+| `int8` | 8 位 | -128 至 127 |
+| `int16` | 16 位 | -32,768 至 32,767 |
+| `int32` | 32 位 | -2^31 至 2^31 - 1 |
+| `int64` | 64 位 | -2^63 至 2^63 - 1 |
+
+**语言映射(有符号):**
+
+| Fory IDL | Java | Python | Go | Rust | C++ | JavaScript/TypeScript | Dart |
+| -------- | ------- | -------------- | ------- | ----- | --------- | --------------------- | ------- |
+| `int8` | `byte` | `pyfory.Int8` | `int8` | `i8` | `int8_t` | `number` | `int` |
+| `int16` | `short` | `pyfory.Int16` | `int16` | `i16` | `int16_t` | `number` | `int` |
+| `int32` | `int` | `pyfory.Int32` | `int32` | `i32` | `int32_t` | `number` | `int` |
+| `int64` | `long` | `pyfory.Int64` | `int64` | `i64` | `int64_t` | `bigint \| number` | `Int64` |
+
+Fory IDL 提供固定宽度无符号整数(32/64 位整数默认使用变长编码):
+
+| Fory IDL | 位宽 | 范围 |
+| -------- | ----- | ------------- |
+| `uint8` | 8 位 | 0 至 255 |
+| `uint16` | 16 位 | 0 至 65,535 |
+| `uint32` | 32 位 | 0 至 2^32 - 1 |
+| `uint64` | 64 位 | 0 至 2^64 - 1 |
+
+**语言映射(无符号):**
+
+| Fory IDL | Java | Python | Go | Rust | C++ | JavaScript/TypeScript | Dart |
+| -------- | ------- | --------------- | -------- | ----- | ---------- | --------------------- | -------- |
+| `uint8` | `short` | `pyfory.UInt8` | `uint8` | `u8` | `uint8_t` | `number` | `int` |
+| `uint16` | `int` | `pyfory.UInt16` | `uint16` | `u16` | `uint16_t` | `number` | `int` |
+| `uint32` | `long` | `pyfory.UInt32` | `uint32` | `u32` | `uint32_t` | `number` | `int` |
+| `uint64` | `long` | `pyfory.UInt64` | `uint64` | `u64` | `uint64_t` | `bigint \| number` | `Uint64` |
+
+#### 整数编码修饰符
+
+对于 32/64 位整数,Fory IDL 默认使用变长编码。需要其他编码格式时,请添加标量编码修饰符:
+
+| 修饰符 | 有效类型 | 说明 |
+| -------- | ------------------------------------ | ---------------- |
+| `varint` | `int32`、`int64`、`uint32`、`uint64` | 默认值的显式拼写 |
+| `fixed` | `int32`、`int64`、`uint32`、`uint64` | 固定宽度小端序 |
+| `tagged` | `int64`、`uint64` | 标记 64 位编码 |
+
+修饰符是标量类型表达式的一部分,因此也可用于嵌套 list 和 map 位置:
```protobuf
fixed int32 id = 1;
@@ -1214,106 +1253,98 @@ list<fixed int32> offsets = 2;
map<string, tagged uint64> counters = 3;
```
-带下划线的整数编码名称不是 FDL 类型名。
+带下划线的整数编码名称不是 FDL 类型名称。
-#### Floating-Point Types
+#### 浮点类型
-| Fory IDL 类型 | 大小 | 精度 |
-| ------------- | ----- | ------------- |
-| `float32` | 32 位 | 约 7 位数字 |
+| Fory IDL 类型 | 位宽 | 精度 |
+| ------------- | ----- | --------------- |
+| `float32` | 32 位 | 约 7 位数字 |
| `float64` | 64 位 | 约 15-16 位数字 |
-| Fory IDL | Java | Python annotation/value | Go | Rust | C++ | JavaScript/TypeScript | Dart |
+**语言映射:**
+
+| Fory IDL | Java | Python 注解/值 | Go | Rust | C++ | JavaScript/TypeScript | Dart |
| ---------- | ---------- | --------------------------- | ------------------- | ---------- | ------------------ | --------------------- | --------- |
| `float16` | `Float16` | `pyfory.Float16` / `float` | `float16.Float16` | `Float16` | `fory::float16_t` | `number` | `double` |
| `bfloat16` | `BFloat16` | `pyfory.BFloat16` / `float` | `bfloat16.BFloat16` | `BFloat16` | `fory::bfloat16_t` | `number` | `double` |
| `float32` | `float` | `pyfory.Float32` | `float32` | `f32` | `float` | `number` | `Float32` |
| `float64` | `double` | `pyfory.Float64` | `float64` | `f64` | `double` | `number` | `double` |
-#### String Type
-
-`string` 使用 UTF-8 文本语义。
-
-| 语言 | 类型 | 说明 |
-| ---------- | ------------- | -------------------- |
-| Java | `String` | 不可变 |
-| Python | `str` | |
-| Go | `string` | 不可变 |
-| Rust | `String` | 所有权字符串,堆分配 |
-| C++ | `std::string` | |
-| JavaScript | `string` | |
-| Dart | `String` | |
-
-#### Bytes Type
-
-`bytes` 用于原始二进制载荷。
-
-| 语言 | 类型 | 说明 |
-| ---------- | ---------------------- | ------ |
-| Java | `byte[]` | |
-| Python | `bytes` | 不可变 |
-| Go | `[]byte` | |
-| Rust | `Vec<u8>` | |
-| C++ | `std::vector<uint8_t>` | |
-| JavaScript | `Uint8Array` | |
-| Dart | `Uint8List` | |
-
-#### Temporal Types
-
-##### Date
-
-`date` 表示日期(不含时区时间部分)。
-
-| 语言 | 类型 | 说明 |
-| ---------- | --------------------- | -------------------------------------------------------------------- |
-| Java | `java.time.LocalDate` | |
-| Python | `datetime.date` | |
-| Go | `time.Time` | 会忽略时间部分 |
-| Rust | `fory::Date` | 设置 `rust_use_chrono_temporal_types = true` 可生成 `chrono::NaiveDate` |
-| C++ | `fory::Date` | |
-| JavaScript | `Date` | |
-| Dart | `LocalDate` | Fory package 提供的类型 |
-
-##### Timestamp
-
-`timestamp` 表示时间点(跨语言应统一时间语义与精度预期)。
-
-| 语言 | 类型 | 说明 |
-| ---------- | --------------------- | ------------------------------------------------------------------------ |
-| Java | `java.time.Instant` | 基于 UTC |
-| Python | `datetime.datetime` | |
-| Go | `time.Time` | |
-| Rust | `fory::Timestamp` | 设置 `rust_use_chrono_temporal_types = true` 可生成 `chrono::NaiveDateTime` |
-| C++ | `fory::Timestamp` | |
-| JavaScript | `Date` | |
-| Dart | `Timestamp` | Fory package 提供的类型 |
+#### 字符串类型
+
+| 语言 | 类型 | 说明 |
+| --------------------- | ------------- | ------------ |
+| Java | `String` | 不可变的 |
+| Python | `str` | |
+| Go | `string` | 不可变的 |
+| Rust | `String` | 拥有,堆分配 |
+| C++ | `std::string` | |
+| JavaScript/TypeScript | `string` | |
+| Dart | `String` | |
+
+#### 字节类型
+
+| 语言 | 类型 | 说明 |
+| --------------------- | ---------------------- | -------- |
+| Java | `byte[]` | |
+| Python | `bytes` | 不可变的 |
+| Go | `[]byte` | |
+| Rust | `Vec<u8>` | |
+| C++ | `std::vector<uint8_t>` | |
+| JavaScript/TypeScript | `Uint8Array` | |
+| Dart | `Uint8List` | |
+
+#### 时间类型
+
+##### 日期
+
+| 语言 | 类型 | 说明 |
+| --------------------- | --------------------- | --------------------------------------------------------------------- |
+| Java | `java.time.LocalDate` | |
+| Python | `datetime.date` | |
+| Go | `time.Time` | 时间部分被忽略 |
+| Rust | `fory::Date` | 设置 `rust_use_chrono_temporal_types = true` 生成 `chrono::NaiveDate` |
+| C++ | `fory::Date` | |
+| JavaScript/TypeScript | `Date` | |
+| Dart | `LocalDate` | Fory 封装类型 |
+
+##### 时间戳
+
+| 语言 | 类型 | 说明 |
+| --------------------- | ------------------- | ------------------------------------------------------------------------- |
+| Java | `java.time.Instant` | 基于 UTC |
+| Python | `datetime.datetime` | |
+| Go | `time.Time` | |
+| Rust | `fory::Timestamp` | 设置 `rust_use_chrono_temporal_types = true` 生成 `chrono::NaiveDateTime` |
+| C++ | `fory::Timestamp` | |
+| JavaScript/TypeScript | `Date` | |
+| Dart | `Timestamp` | Fory 封装类型 |
##### Duration
-`duration` 表示一段时间长度。
-
-| 语言 | 类型 | 说明 |
-| ------ | -------------------- | --------------------------------------------------------------------- |
-| Java | `java.time.Duration` | |
-| Python | `datetime.timedelta` | |
-| Go | `time.Duration` | |
-| Rust | `fory::Duration` | 设置 `rust_use_chrono_temporal_types = true` 可生成 `chrono::Duration` |
-| C++ | `fory::Duration` | |
-| Dart | `Duration` | |
+| 语言 | 类型 | 说明 |
+| ------ | -------------------- | -------------------------------------------------------------------- |
+| Java | `java.time.Duration` | |
+| Python | `datetime.timedelta` | |
+| Go | `time.Duration` | |
+| Rust | `fory::Duration` | 设置 `rust_use_chrono_temporal_types = true` 生成 `chrono::Duration` |
+| C++ | `fory::Duration` | |
+| Dart | `Duration` | |
#### Any
-| 语言 | 类型 | 说明 |
-| --------------------- | ---------------------------- | -------------------- |
-| Java | `Object` | 写入具体值的类型元信息 |
-| Python | `Any` | 写入具体值的类型元信息 |
-| Go | `any` | 写入具体值的类型元信息 |
-| Rust | `Arc<dyn Any + Send + Sync>` | 写入具体值的类型元信息 |
-| C++ | `std::any` | 写入具体值的类型元信息 |
-| JavaScript/TypeScript | `any` | 写入具体值的类型元信息 |
-| Dart | `Object?` | 写入具体值的类型元信息 |
+| 语言 | 类型 | 说明 |
+| --------------------- | ---------------------------- | ---------------------- |
+| Java | `Object` | 写入的具体值类型元数据 |
+| Python | `Any` | 写入的具体值类型元数据 |
+| Go | `any` | 写入的具体值类型元数据 |
+| Rust | `Arc<dyn Any + Send + Sync>` | 写入具体值的类型元数据 |
+| C++ | `std::any` | 写入的具体值类型元数据 |
+| JavaScript/TypeScript | `any` | 写入的具体值类型元数据 |
+| Dart | `Object?` | 写入具体值的类型元数据 |
-示例:
+**示例:**
```protobuf
enum EventType [id=120] {
@@ -1331,29 +1362,32 @@ message Envelope [id=122] {
}
```
-`Envelope.payload` 生成类型:
+**生成的代码(`Envelope.payload`):**
-| 语言 | 生成字段类型 |
-| --------------------- | ------------------------------------ |
-| Java | `Object payload` |
-| Python | `payload: Any` |
-| Go | `Payload any` |
+| 语言 | 生成的字段类型 |
+| --------------------- | ------------------------------------- |
+| Java | `Object payload` |
+| Python | `payload: Any` |
+| Go | `Payload any` |
| Rust | `payload: Arc<dyn Any + Send + Sync>` |
-| C++ | `std::any payload` |
-| JavaScript/TypeScript | `payload: any` |
-| Dart | `Object? payload` |
+| C++ | `std::any payload` |
+| JavaScript/TypeScript | `payload: any` |
+| Dart | `Object? payload` |
-注意:
+**说明:**
-- `any` 始终写入空值标记(与 `nullable` 相同),因为值可能为空。
-- 不支持将 `optional` 和 `[nullable = true]` 直接用于 `any`;请使用 `any`、`list<any>` 或 `map<K, any>`,不要使用 `optional any`、`list<optional any>` 或 `map<K, optional any>`。
-- 动态值只能是 `bool`、`string`、enum、message 和 union。其他基本类型(数字、bytes、日期/时间)以及 list/map 不受支持;请将其包装在 message 中或改用显式字段。
-- `any` 字段(包括 list/map value)不能使用 `ref`。如果需要引用跟踪,请用 message 包装 `any`。
-- 具体类型必须在目标语言的 Schema/IDL 注册中登记;遇到未知类型时反序列化会失败。
+- `any` 始终写入 null 标志(与 `nullable` 相同),因为值可能为空。
+- `optional` 和 `[nullable = true]` 不能直接用于 `any`;请使用
+ `any`、`list<any>` 或 `map<K, any>` 而不是 `optional any`,
+ `list<optional any>` 或 `map<K, optional any>`。
+- 允许的动态值仅限于 `bool`、`string`、`enum`、`message` 和 `union`。
+ 不支持其他基本类型(数字、字节、日期/时间)和 list/map;请将它们包装在消息中,或改用显式字段。
+- `ref` 不允许用于 `any` 字段(包括 list/map 值)。如果需要引用跟踪,请将 `any` 包装在消息中。
+- 具体类型必须在目标语言 Schema/IDL 注册表中注册;未知类型无法反序列化。
-### Named Types
+### 命名类型
-可以按名称引用其他 message、enum 或 union:
+按名称引用其他消息、枚举或联合:
```protobuf
enum Status { ... }
@@ -1365,17 +1399,20 @@ message Order {
}
```
-### Collection Types
+### 集合类型
-#### List (`list`)
+#### 列表 (`list`)
-列表字段使用 `list<...>` 类型,`repeated` 是其别名。修饰符组合和语言映射详见[字段修饰符](#字段修饰符)。
+列表字段使用 `list<...>` 类型。`repeated` 也可作为别名。修饰符组合和语言映射请参阅[字段修饰符](#field-modifiers)。
-嵌套集合是否可用取决于目标语言的实现能力。C++ 生成器支持 `list<list<...>>`、`list<map<...>>` 和 `map<..., list<...>>` 等嵌套集合定义;尚未实现嵌套字段定义的目标语言仍会拒绝这些写法。若需让 Schema 在所有目标语言中可移植,请使用 message 包装。
+嵌套集合支持取决于目标语言能力。C++ 生成器接受 `list<list<...>>`、
+`list<map<...>>` 和 `map<..., list<...>>` 等嵌套集合 Schema;尚未实现嵌套字段
+Schema 的目标语言仍会拒绝这些写法。如果需要跨所有目标语言的可移植 Schema,请使用消息包装器。
-#### Array (`array`)
+#### 数组 (`array`)
-`array<T>` 用于动态长度的稠密数值数据。它与 `list<T>` 是不同的 Schema 类型,使用紧凑基本类型数组编码载荷。
+对于动态长度的密集数值数据,请使用 `array<T>`。`array<T>` 是与 `list<T>` 不同的
+Schema 类型,使用紧凑的基本类型数组编码载荷。
```protobuf
message Embedding {
@@ -1385,32 +1422,40 @@ message Embedding {
}
```
-`array<T>` 只接受 `bool`、整数和浮点数元素域,不接受 `optional`、`ref`、具名/对象类型、`string`、`bytes`、map 或 `array<fixed int32>` 等标量整数编码修饰符;array 契约规定元素始终使用定长编码。
-
-生成的承载类型因语言而异,但 Schema 类型保持一致:
-
-| IDL Schema | Java 默认类型 | Python 默认类型 | Dart 默认类型 | JavaScript/TypeScript |
-| ----------------- | ----------------------------- | ----------------------- | --------------- | ------------------------ |
-| `list<bool>` | `BoolList` / `List<Boolean>` | `List[bool]` | `List<bool>` | `Type.list(Type.bool())` |
-| `array<bool>` | `boolean[]` | `pyfory.BoolArray` | `BoolList` | `Type.boolArray()` |
-| `array<int8>` | `@Int8Type byte[]` | `pyfory.Int8Array` | `Int8List` | `Type.int8Array()` |
-| `array<int16>` | `short[]` | `pyfory.Int16Array` | `Int16List` | `Type.int16Array()` |
-| `array<int32>` | `int[]` | `pyfory.Int32Array` | `Int32List` | `Type.int32Array()` |
-| `array<int64>` | `long[]` | `pyfory.Int64Array` | `Int64List` | `Type.int64Array()` |
-| `array<uint8>` | `@UInt8Type byte[]` | `pyfory.UInt8Array` | `Uint8List` | `Type.uint8Array()` |
-| `array<uint16>` | `@UInt16Type short[]` | `pyfory.UInt16Array` | `Uint16List` | `Type.uint16Array()` |
-| `array<uint32>` | `@UInt32Type int[]` | `pyfory.UInt32Array` | `Uint32List` | `Type.uint32Array()` |
-| `array<uint64>` | `@UInt64Type long[]` | `pyfory.UInt64Array` | `Uint64List` | `Type.uint64Array()` |
-| `array<float16>` | `Float16Array` | `pyfory.Float16Array` | `Float16List` | `Type.float16Array()` |
-| `array<bfloat16>` | `BFloat16Array` | `pyfory.BFloat16Array` | `Bfloat16List` | `Type.bfloat16Array()` |
-| `array<float32>` | `float[]` | `pyfory.Float32Array` | `Float32List` | `Type.float32Array()` |
-| `array<float64>` | `double[]` | `pyfory.Float64Array` | `Float64List` | `Type.float64Array()` |
-
-手写 Dart 模型中,`array<bool>` 需要使用 `BoolList` 加 `@ArrayField(element: BoolType())`,或 `@ForyField(type: ArrayType(element: BoolType()))`;`List<bool>` 仍表示 `list<bool>`。手写 Java 模型中,无符号基本类型数组在元素类型上使用 type-use annotation,例如 `private @UInt32Type int[] ids;`。生成的 Kotlin 模型中,`array<int8>` 使用 `@ArrayType ByteArray`,嵌套集合和 map 中也一样。
+`array<T>` 仅接受 `bool`、整数和浮点元素类型。它不接受 `optional`、`ref`、
+命名/对象类型、`string`、`bytes`、map,也不接受 `array<fixed int32>` 等标量整数编码修饰符;
+根据数组约定,数组元素始终采用固定宽度编码。
+
+生成的载体因语言而异,但 Schema 类型保持一致:
+
+| IDL Schema | Java 默认值 | Python 默认值 | Dart 默认值 | JavaScript/TypeScript |
+| ----------------- | ---------------------------- | ---------------------- | -------------- | ------------------------ |
+| `list<bool>` | `BoolList` / `List<Boolean>` | `List[bool]` | `List<bool>` | `Type.list(Type.bool())` |
+| `array<bool>` | `boolean[]` | `pyfory.BoolArray` | `BoolList` | `Type.boolArray()` |
+| `array<int8>` | `@Int8Type byte[]` | `pyfory.Int8Array` | `Int8List` | `Type.int8Array()` |
+| `array<int16>` | `short[]` | `pyfory.Int16Array` | `Int16List` | `Type.int16Array()` |
+| `array<int32>` | `int[]` | `pyfory.Int32Array` | `Int32List` | `Type.int32Array()` |
+| `array<int64>` | `long[]` | `pyfory.Int64Array` | `Int64List` | `Type.int64Array()` |
+| `array<uint8>` | `@UInt8Type byte[]` | `pyfory.UInt8Array` | `Uint8List` | `Type.uint8Array()` |
+| `array<uint16>` | `@UInt16Type short[]` | `pyfory.UInt16Array` | `Uint16List` | `Type.uint16Array()` |
+| `array<uint32>` | `@UInt32Type int[]` | `pyfory.UInt32Array` | `Uint32List` | `Type.uint32Array()` |
+| `array<uint64>` | `@UInt64Type long[]` | `pyfory.UInt64Array` | `Uint64List` | `Type.uint64Array()` |
+| `array<float16>` | `Float16Array` | `pyfory.Float16Array` | `Float16List` | `Type.float16Array()` |
+| `array<bfloat16>` | `BFloat16Array` | `pyfory.BFloat16Array` | `Bfloat16List` | `Type.bfloat16Array()` |
+| `array<float32>` | `float[]` | `pyfory.Float32Array` | `Float32List` | `Type.float32Array()` |
+| `array<float64>` | `double[]` | `pyfory.Float64Array` | `Float64List` | `Type.float64Array()` |
+
+对于手写 Dart 模型,`array<bool>` 需要 `BoolList`,并添加
+`@ArrayField(element: BoolType())` 或
+`@ForyField(type: ArrayType(element: BoolType()))`;`List<bool>` 仍对应
+`list<bool>`。对于手写 Java 模型,无符号基本类型数组在元素类型上使用类型注解,
+例如 `private @UInt32Type int[] ids;`。
+对于生成的 Kotlin 模型,`array<int8>` 使用 `@ArrayType ByteArray`,
+包括嵌套集合和 map 位置。
#### Map
-使用具名 key 和 value 的 map:
+具有指定键和值类型的 Map:
```protobuf
message Config {
@@ -1420,51 +1465,61 @@ message Config {
}
```
-| Fory IDL | Java | Python | Go | Rust | C++ | JavaScript/TypeScript | Dart |
-| -------------------- | ---------------------- | ----------------- | ------------------ | ----------------------- | ------------------------------------------ | --------------------- | ------------------ |
-| `map<string, int32>` | `Map<String, Integer>` | `Dict[str, int]` | `map[string]int32` | `HashMap<String, i32>` | `std::unordered_map<std::string, int32_t>` | `Map<string, number>` | `Map<String, int>` |
+**语言映射:**
+
+| Fory IDL | Java | Python | Go | Rust | C++ | JavaScript/TypeScript | Dart |
+| -------------------- | ---------------------- | ----------------- | ------------------ | ----------------------- | ------------------------------------------ | --------------------- | ------------------- |
+| `map<string, int32>` | `Map<String, Integer>` | `Dict[str, int]` | `map[string]int32` | `HashMap<String, i32>` | `std::unordered_map<std::string, int32_t>` | `Map<string, number>` | `Map<String, int>` |
| `map<string, User>` | `Map<String, User>` | `Dict[str, User]` | `map[string]User` | `HashMap<String, User>` | `std::unordered_map<std::string, User>` | `Map<string, User>` | `Map<String, User>` |
-key 类型限制:
+**键类型限制:**
-- `string`(最常用)
+- `string`(最常见)
- `bool`
- 整数类型(`int8`、`int16`、`int32`、`int64`、`uint8`、`uint16`、`uint32`、`uint64`)
- 时间标量类型(`date`、`timestamp`、`duration`)
-- enum
-
-map key 不支持 `any`、二进制 `bytes`、浮点数、`decimal`、message、union、`list<T>`、`array<T>` 或嵌套 `map<K, V>`。请把这些类型放在 map value 中,或使用以可移植标量或 enum 为 key 的 message 包装。
+- 枚举
-### Type Compatibility Matrix
+Map 键不支持 `any`、二进制 `bytes`、浮点类型、`decimal`、消息类型、联合类型、
+`list<T>`、`array<T>` 或嵌套 `map<K, V>`。请将这些类型用于 Map 值,或使用可移植的标量或枚举键将它们包装在消息中。
-下表列出跨语言安全的类型转换:
+### 类型兼容性矩阵
-| From -> To | bool | int8 | int16 | int32 | int64 | float32 | float64 | string |
-| ---------- | ---- | ---- | ----- | ----- | ----- | ------- | ------- | ------ |
-| bool | Y | Y | Y | Y | Y | - | - | - |
-| int8 | - | Y | Y | Y | Y | Y | Y | - |
-| int16 | - | - | Y | Y | Y | Y | Y | - |
-| int32 | - | - | - | Y | Y | - | Y | - |
-| int64 | - | - | - | - | Y | - | - | - |
-| float32 | - | - | - | - | - | Y | Y | - |
-| float64 | - | - | - | - | - | - | Y | - |
-| string | - | - | - | - | - | - | - | Y |
+该矩阵显示了哪些类型转换在不同语言中是安全的:
-Y 表示安全转换,- 表示不建议转换。
+| 从 -> 到 | bool | int8 | int16 | int32 | int64 | float32 | float64 | string |
+| -------- | ---- | ---- | ----- | ----- | ----- | ------- | ------- | ------ |
+| bool | 是 | 是 | 是 | 是 | 是 | - | - | - |
+| int8 | - | 是 | 是 | 是 | 是 | 是 | 是 | - |
+| int16 | - | - | 是 | 是 | 是 | 是 | 是 | - |
+| int32 | - | - | - | 是 | 是 | - | 是 | - |
+| int64 | - | - | - | - | 是 | - | - | - |
+| float32 | - | - | - | - | - | 是 | 是 | - |
+| float64 | - | - | - | - | - | - | 是 | - |
+| string | - | - | - | - | - | - | - | 是 |
-### Best Practices
+Y = 安全转换,- = 不推荐
-- 大多数整数优先使用 `int32`,数值很大时使用 `int64`。
-- 文本数据(UTF-8)使用 `string`,二进制数据使用 `bytes`。
-- 只有字段确实可能缺失时才使用 `optional`。
-- 只有需要共享引用或循环引用时才使用 `ref`。
-- 有序序列优先使用 `list`,键值查找使用 `map`。
+### 最佳实践
-## Type IDs
+- 使用 `int32` 作为大多数整数的默认值;对于较大值,请使用 `int64`。
+- 对于文本数据 (UTF-8) 使用 `string`,对于二进制数据使用 `bytes`。
+- 仅当该字段可能合法地不存在时才使用 `optional`。
+- 仅当需要共享或循环引用时才使用 `ref`。
+- 对于有序序列,首选 `list`;对于键值查找,首选 `map`。
-类型 ID 用于高效的跨语言序列化,适用于 message、union 和 enum。当 `enable_auto_type_id = true`(默认)且省略 `id` 时,编译器通过 `MurmurHash3(utf8(package.type_name))`(32 位)自动生成类型 ID,并将其注解到生成代码中。当 `enable_auto_type_id = false` 时,没有显式 ID 的类型改为通过命名空间和名称注册。编译器会在当前文件及所有 import 中检测冲突;发生冲突时,会报告错误并要求显式配置 `id` 或 `alias`。
+## 类型 ID {#type-ids}
-对于 Java 和 Scala 生成代码,嵌套名称注册会把父路径追加到命名空间,同时保留嵌套类型的简单名称。例如,`package demo; message Envelope { message Payload { ... } }` 在这些 JVM 目标语言中会把 `Payload` 注册为命名空间 `demo.Envelope`、类型名 `Payload`。
+类型 ID 用于消息、联合类型和枚举,可实现高效的跨语言序列化。当
+`enable_auto_type_id = true`(默认)且省略 `id` 时,编译器通过
+`MurmurHash3(utf8(package.type_name))`(32 位)自动生成 ID,并在生成的代码中注明。
+当 `enable_auto_type_id = false` 时,没有显式 ID 的类型改为按命名空间和名称注册。
+编译器会在当前文件和所有导入文件中检测冲突;发生冲突时,
+编译器会引发错误并要求显式 `id` 或 `alias`。
+对于 Java 和 Scala 生成的代码,嵌套名称注册会把父级路径附加到 namespace,
+同时保留嵌套类型的简单名称。例如,
+`package demo; message Envelope { message Payload { ... } }` 在这些 JVM 目标中
+会注册 `Payload`:其 namespace 为 `demo.Envelope`,类型名称为 `Payload`。
```protobuf
enum Color [id=100] { ... }
@@ -1472,28 +1527,31 @@ message User [id=101] { ... }
union Event [id=102] { ... }
```
-enum 类型 ID 仍是可选的;若省略且 `enable_auto_type_id = true`,则使用同样的哈希算法自动生成。
+枚举类型 ID 仍是可选的;当 `enable_auto_type_id = true` 时,如果省略 ID,
+编译器会使用相同的哈希算法自动生成 ID。
-### 显式类型 ID
+### 使用显式类型 ID
```protobuf
message User [id=101] { ... }
message User [id=101, deprecated=true] { ... } // Multiple options
```
-### 无显式类型 ID
+### 不使用显式类型 ID
```protobuf
message Config { ... } // Auto-generated when enable_auto_type_id = true
```
-可设置 `[alias="..."]` 来改变哈希输入,而无需重命名类型。
+您可以设置 `[alias="..."]` 来更改哈希源,而无需重命名类型。
-### 实践说明
+### 实用说明
-- 类型省略 `id` 且 `enable_auto_type_id = true` 时,Fory 使用 `MurmurHash3(utf8(package.type_name))`(32 位)生成 ID。
-- package alias 和类型 alias 会改变哈希输入,可在不重命名公共类型的情况下解决哈希冲突。
-- 较小 varint 范围(`0-127`)内的手动 ID 在编码格式中更紧凑;自动 ID 通常更大,一般占用 4-5 字节。
+- 如果类型省略 `id` 且 `enable_auto_type_id = true`,Fory 会使用
+ `MurmurHash3(utf8(package.type_name))`(32 位)生成 ID。
+- 包别名和类型别名会改变哈希输入,可在不重命名公共类型的情况下解决哈希冲突。
+- 小 varint 范围(`0-127`)内的手动 ID 在 wire format 中更紧凑;自动生成的 ID
+ 通常更大,一般占用 4-5 字节。
### ID 分配策略
@@ -1588,9 +1646,10 @@ message ShopConfig {
}
```
-Protobuf 专用扩展选项与 `(fory).` 语法详见 [Protocol Buffers IDL Support](protobuf-idl.md#fory-extension-options-protobuf)。
+有关 protobuf 特定的扩展选项和 `(fory).` 语法,请参阅
+[协议缓冲区 IDL 支持](protobuf-idl.md#fory-extension-options-protobuf)。
-## 语法摘要
+## 语法总结
```
file := [package_decl] file_option* import_decl* definition*
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/_category_.json b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/_category_.json
new file mode 100644
index 0000000000..fcbc87b9bf
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/_category_.json
@@ -0,0 +1,6 @@
+{
+ "position": 9,
+ "label": "开发",
+ "collapsible": true,
+ "collapsed": true
+}
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/building.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/building.md
new file mode 100644
index 0000000000..b7e336c288
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/building.md
@@ -0,0 +1,134 @@
+---
+title: 开发
+sidebar_position: 20
+id: building
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+## 如何构建 Apache Fory™
+
+从 https://github.com/apache/fory 克隆源代码树。
+
+### 构建 Apache Fory™ Java
+
+```bash
+cd java
+mvn -T16 package
+```
+
+#### 环境要求
+
+- JDK 17+
+- Maven 3.6.3+
+
+### 构建 Apache Fory™ Python
+
+```bash
+cd python
+pip install -v -e .
+
+# Optional: build Cython extension (replace X.Y with your Python version)
+bazel build //:cp_fory_so --@rules_python//python/config_settings:python_version=X.Y
+```
+
+#### 环境要求
+
+- CPython 3.8+
+- Bazel 8+(构建 Cython 扩展时必需)
+
+### 构建 Apache Fory™ C++
+
+```bash
+cd cpp
+bazel build //cpp/...
+```
+
+#### 环境要求
+
+- C++17 编译器
+- Bazel 8+
+
+### 构建 Apache Fory™ Go
+
+```bash
+cd go/fory
+go test -v ./...
+```
+
+从 Java 测试模块运行 Go xlang 测试:
+
+```bash
+cd java
+mvn -T16 install -DskipTests
+cd fory-core
+FORY_GO_JAVA_CI=1 ENABLE_FORY_DEBUG_OUTPUT=1 mvn test -Dtest=org.apache.fory.xlang.GoXlangTest
+```
+
+#### 环境要求
+
+- Go 1.24+
+
+### 构建 Apache Fory™ Rust
+
+```bash
+cd rust
+cargo build
+cargo test --features tests
+
+# Debug a specific test
+RUST_BACKTRACE=1 FORY_PANIC_ON_ERROR=1 ENABLE_FORY_DEBUG_OUTPUT=1 \
+ cargo test --test mod $dir$::$test_file::$test_method -- --nocapture
+```
+
+#### 环境要求
+
+- 通过 rustup 安装的 Rust 工具链
+- `cargo-expand`(可选,用于调试宏展开)
+
+### 构建 Apache Fory™ JavaScript
+
+```bash
+cd javascript
+npm install
+
+npm run build
+node ./node_modules/.bin/jest --ci --reporters=default --reporters=jest-junit
+```
+
+#### 环境要求
+
+- Node.js (LTS)
+- npm
+
+### 检查 Markdown 文档
+
+```bash
+cd docs
+npx prettier --write "**/*.md"
+```
+
+#### 环境要求
+
+- Node.js (LTS)
+- npm
+
+## 参与贡献
+
+有关贡献的详细信息,请参阅[如何为 Apache Fory™ 做贡献](https://github.com/apache/fory/blob/main/CONTRIBUTING.md)。
+对于 AI 辅助的贡献,请遵循
+[AI 贡献政策](https://github.com/apache/fory/blob/main/AI_POLICY.md),包括大量使用 AI 辅助时
+所需的自我审查、双审查者 AI 审查流程、披露和验证证据。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/cpp-debugging.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/cpp-debugging.md
new file mode 100644
index 0000000000..9610822aa1
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/cpp-debugging.md
@@ -0,0 +1,46 @@
+---
+layout: global
+title: 调试 C++
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+import JumpGeneratedFile from "@site/docs/images/jmp_generate_file.png";
+import VscodeDebugFory from "@site/docs/images/vscode_debug_fory.jpg";
+import VscodeSelectDebugRun from "@site/docs/images/vscode_select_debug_run.png";
+
+## 调试 C++
+
+调试 C++ 并不容易,如果没有调试支持,二进制协议中的缺陷很难定位,而为 bazel 项目配置
+调试支持也并非易事。
+
+Apache Fory™ 提供了开箱即用的 `launch.json/tasks.json` 配置,该配置位于 `.vscode` 目录中,用于调试 C++。
+
+只需在 vscode 中打开 fory 根目录,然后打开 `src/fory/row/row_test.cc` 等测试文件,
+按下 `F5`,便可像调试 java/python 一样在 vscode 中逐行调试 C++ 代码、监视变量并添加断点。
+
+<img src={VscodeDebugFory} alt="Apache Fory™ 调试示例" width="50%" height="50%" />
+
+## 注意事项
+
+- 对于 Macos:安装 `CodeLLDB` vscode 插件
+- 对于 Linux:
+ - 使用 `sudo yum install -y gdb` 为 fedora/centos 安装 gdb
+ - 使用 `sudo apt-get install gdb` 为 fedora/centos 安装 gdb
+- 如果无法调试,请选择正确的调试/运行选项:
+ <img src={VscodeSelectDebugRun} alt="选择正确的调试/运行选项" width="50%" height="50%" />
+- 调试时会跳转到 bazel 生成目录中的源文件,需要返回源代码树中的原始文件才能再次调试:
+ <img src={JumpGeneratedFile} alt="跳转到生成的文件" width="50%" height="50%" />
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/index.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/index.md
new file mode 100644
index 0000000000..9e547b6e14
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/development/index.md
@@ -0,0 +1,32 @@
+---
+title: 开发
+sidebar_position: 1
+id: index
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+贡献者文档涵盖仓库设置、构建、测试、调试和面向发布的工作流程。
+这部分文档与已发布构件的用户指南相互独立。
+
+## 从这里开始
+
+- [构建并测试仓库](building.md)
+- [调试 C++ 实现](cpp-debugging.md)
+- [贡献指南](https://github.com/apache/fory/blob/main/CONTRIBUTING.md)
+
+不属于共享仓库构建的运行时特定贡献者说明,仍保留在各运行时的源代码树和贡献者
+README 中。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/_category_.json b/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/_category_.json
new file mode 100644
index 0000000000..44de805e1a
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/_category_.json
@@ -0,0 +1,6 @@
+{
+ "position": 8,
+ "label": "Fory gRPC",
+ "collapsible": true,
+ "collapsed": true
+}
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/architecture.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/architecture.md
new file mode 100644
index 0000000000..9e2b817e1e
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/architecture.md
@@ -0,0 +1,35 @@
+---
+title: 架构
+sidebar_position: 2
+id: architecture
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+生成的服务配套代码使用标准 gRPC server、channel、方法描述符、deadline、状态码、interceptor
+和流式 API。Fory 生成的 marshaller 负责对生成的请求和响应模型进行编码和解码。
+
+## 职责边界
+
+Fory 可以为应用提供的 gRPC 运行时生成服务配套代码。这些代码为请求和响应对象提供 Fory 序列化;
+listener、channel、credential、身份认证、授权、deadline、重试和传输生命周期仍由应用和 gRPC 技术栈负责。
+
+Fory 软件包不会将某个 gRPC 实现作为强制依赖。应用负责选择和配置运行时的 gRPC 库。
+
+## 生成的服务接口
+
+编译器会生成符合运行时习惯的 service base、client 或 stub、方法元数据和 Fory marshaller。
+模型生成详见[生成代码](../compiler/generated-code/index.md);各运行时页面介绍 server 与 client 集成。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/cpp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/cpp.md
new file mode 100644
index 0000000000..b2aca81c3d
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/cpp.md
@@ -0,0 +1,262 @@
+---
+title: C++ gRPC
+sidebar_position: 6
+id: cpp
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+对于定义了服务的 Schema,Fory 可以生成 C++ gRPC 服务配套代码。生成的代码使用
+gRPC C++ 进行传输,并使用 Fory 序列化请求和响应载荷。该功能要求 gRPC C++
+1.39.0 或更高版本。
+
+当所有 RPC 对等端都由同一份 Fory IDL、protobuf IDL 或 FlatBuffers IDL 生成,
+并且你希望结合 gRPC 传输语义与 Fory 载荷编码时,请使用此模式。如果客户端或工具
+必须直接处理 protobuf 消息字节,请使用标准的 protobuf gRPC 代码生成。
+
+## 添加依赖
+
+使用 Bazel 时,请使用工作区内可见的 Fory 标签。下面的示例适用于将 Fory 作为名为
+`fory` 的外部模块引入的项目:
+
+```bazel
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
+cc_library(
+ name = "greeter_generated",
+ srcs = ["generated/demo_greeter.service.grpc.cc"],
+ hdrs = glob(["generated/*.h"]),
+ includes = ["generated"],
+ deps = [
+ "@fory//cpp/fory/serialization:fory_serialization",
+ "@grpc//:grpc++",
+ ],
+)
+```
+
+在 Fory 仓库内,请使用 `//cpp/fory/serialization:fory_serialization`,而不是
+`@fory//cpp/fory/serialization:fory_serialization`。
+
+使用 CMake 时,请先确保 Fory C++ 目标可见。如果使用已安装的 Fory 包,请调用
+`find_package(Fory CONFIG REQUIRED)`,然后添加生成的源文件,并显式链接这两个库:
+
+```cmake
+find_package(Fory CONFIG REQUIRED)
+find_package(gRPC 1.39.0 CONFIG REQUIRED)
+
+add_library(greeter_generated
+ generated/demo_greeter.service.grpc.cc
+)
+target_compile_features(greeter_generated PUBLIC cxx_std_17)
+target_include_directories(greeter_generated PUBLIC generated)
+target_link_libraries(greeter_generated PUBLIC
+ fory::serialization
+ gRPC::grpc++
+)
+```
+
+如果项目通过 `FetchContent` 或 `add_subdirectory` 引入 Fory,请先完成引入,再链接
+`fory::serialization`。
+
+请使用与服务技术栈其余部分兼容的依赖版本。
+
+## 定义服务
+
+服务定义可以来自 Fory IDL、protobuf IDL 或 FlatBuffers `rpc_service` 定义。
+Fory IDL 服务如下所示:
+
+```protobuf
+package demo.greeter;
+
+message HelloRequest {
+ string name = 1;
+}
+
+message HelloReply {
+ string reply = 1;
+}
+
+service Greeter {
+ rpc SayHello (HelloRequest) returns (HelloReply);
+}
+```
+
+使用 `--grpc` 生成 C++ 模型和 gRPC 配套代码:
+
+```bash
+foryc service.fdl --cpp_out=./generated/cpp --grpc
+```
+
+对于此 Schema,C++ 生成器会输出:
+
+| 文件 | 用途 |
+| ------------------------------ | ---------------------------------------- |
+| `demo_greeter.h` | Fory 模型类型和注册辅助函数 |
+| `demo_greeter.service.h` | 同步服务接口和路径常量 |
+| `demo_greeter.service.grpc.h` | 同步客户端、服务器适配器和 Fory 编解码器 |
+| `demo_greeter.service.grpc.cc` | Stub 调用和服务器路由实现 |
+
+在应用代码中包含生成的 gRPC 头文件,并在构建目标中只编译一次
+`demo_greeter.service.grpc.cc`。编解码器会直接生成在 gRPC 头文件中;没有单独的
+Fory gRPC 运行时源文件。
+
+## 实现服务器
+
+实现生成的同步接口,并将生成的服务器适配器注册到常规 gRPC C++ 服务器。
+
+```cpp
+#include "demo_greeter.service.grpc.h"
+
+#include <memory>
+#include <grpcpp/server_builder.h>
+#include <grpcpp/security/server_credentials.h>
+
+class MyGreeter final : public demo::greeter::service::Greeter {
+ public:
+ ::grpc::Status SayHello(::grpc::ServerContext* context,
+ const ::demo::greeter::HelloRequest* request,
+ ::demo::greeter::HelloReply* response) override {
+ (void)context;
+ response->set_reply("Hello, " + request->name());
+ return ::grpc::Status::OK;
+ }
+};
+
+MyGreeter implementation;
+demo::greeter::service::grpc::GreeterServiceGrpc service(&implementation);
+::grpc::ServerBuilder builder;
+builder.AddListeningPort("0.0.0.0:50051", ::grpc::InsecureServerCredentials());
+builder.RegisterService(&service);
+std::unique_ptr<::grpc::Server> server = builder.BuildAndStart();
+server->Wait();
+```
+
+生成的服务代码会序列化生成的请求和响应类型,因此服务实现无需手动执行 Fory 注册。
+
+## 创建客户端
+
+使用生成的同步客户端 Stub:
+
+```cpp
+#include "demo_greeter.service.grpc.h"
+
+#include <iostream>
+#include <grpcpp/create_channel.h>
+#include <grpcpp/security/credentials.h>
+
+auto channel =
+ ::grpc::CreateChannel("localhost:50051", ::grpc::InsecureChannelCredentials());
+auto stub = demo::greeter::service::grpc::GreeterStub::NewStub(channel);
+
+demo::greeter::HelloRequest request;
+request.set_name("Fory");
+demo::greeter::HelloReply response;
+::grpc::ClientContext context;
+::grpc::Status status = stub->SayHello(&context, request, &response);
+if (status.ok()) {
+ std::cout << response.reply() << std::endl;
+}
+```
+
+通道配置、凭证、截止时间、元数据、取消、重试策略和传输生命周期仍由 gRPC C++ 负责。
+
+## 流式 RPC
+
+Fory 服务定义可以使用一元、服务器流式、客户端流式和双向流式 RPC 形式:
+
+```protobuf
+service Greeter {
+ rpc SayHello (HelloRequest) returns (HelloReply);
+ rpc LotsOfReplies (HelloRequest) returns (stream HelloReply);
+ rpc LotsOfGreetings (stream HelloRequest) returns (HelloReply);
+ rpc Chat (stream HelloRequest) returns (stream HelloReply);
+}
+```
+
+生成的 C++ 代码遵循同步 gRPC C++ 约定:
+
+- 一元方法返回 `grpc::Status`,并使用请求和响应指针。
+- 服务器流式方法在客户端返回 `std::unique_ptr<grpc::ClientReader<U>>`,在服务器端
+ 接收 `grpc::ServerWriter<U>*`。
+- 客户端流式方法在客户端返回 `std::unique_ptr<grpc::ClientWriter<T>>`,在服务器端
+ 接收 `grpc::ServerReader<T>*`。
+- 双向流式方法在客户端返回 `std::unique_ptr<grpc::ClientReaderWriter<T, U>>`,
+ 在服务器端接收 `grpc::ServerReaderWriter<U, T>*`。
+- 每个消息帧(包括流式消息帧)都使用生成的编解码器。
+
+在服务实现中,请以生成的方法签名作为具体请求和响应类型的准确信息来源:
+
+```cpp
+::grpc::Status LotsOfReplies(
+ ::grpc::ServerContext* context,
+ const ::demo::greeter::HelloRequest* request,
+ ::grpc::ServerWriter<::demo::greeter::HelloReply>* writer) override {
+ (void)context;
+ ::demo::greeter::HelloReply reply;
+ reply.set_reply("Hello, " + request->name());
+ writer->Write(reply);
+ reply.set_reply("Welcome, " + request->name());
+ writer->Write(reply);
+ return ::grpc::Status::OK;
+}
+```
+
+生成的客户端会返回标准 gRPC C++ 流式辅助对象:
+
+```cpp
+demo::greeter::HelloRequest request;
+request.set_name("Fory");
+
+::grpc::ClientContext context;
+auto reader = stub->LotsOfReplies(&context, request);
+demo::greeter::HelloReply reply;
+while (reader->Read(&reply)) {
+ std::cout << reply.reply() << std::endl;
+}
+::grpc::Status status = reader->Finish();
+```
+
+使用 `WritesDone()` 结束客户端流,并始终调用 `Finish()` 获取最终状态。
+
+生成的描述符会为 gRPC 路径保留 IDL 中准确的服务名和方法名。
+
+## gRPC 运行时行为
+
+生成的服务配套代码只提供 Fory 序列化和 gRPC C++ 绑定。运行行为仍遵循标准 gRPC C++
+行为:
+
+- 截止时间和取消
+- TLS 和身份认证
+- 状态码和元数据
+- 通道和服务器生命周期
+- 同步流式反压
+
+## 故障排除
+
+### 缺少 gRPC C++ 头文件或符号
+
+将上文所示的 gRPC C++ 依赖添加到编译生成服务文件的目标中,并确保生成的
+`.service.grpc.cc` 文件只编译一次。
+
+### `UNIMPLEMENTED`
+
+确认已通过 `ServerBuilder::RegisterService(...)` 注册生成的服务器适配器,并确认
+客户端和服务器由相同的包名、服务名和方法名生成。
+
+### Protobuf 客户端无法解码服务
+
+Fory gRPC 配套代码的消息不使用 protobuf 编码格式。对于 Fory 生成的服务,请使用
+Fory 生成的客户端;如果需要支持通用 protobuf 客户端,请另行提供 protobuf 服务端点。
diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/csharp.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/csharp.md
new file mode 100644
index 0000000000..6cea928975
--- /dev/null
+++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/grpc/csharp.md
@@ -0,0 +1,300 @@
+---
+title: C# gRPC
+sidebar_position: 10
+id: csharp
+license: |
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+---
+
+对于定义了服务的 Schema,Fory 可以生成 C# gRPC 服务配套代码。生成的代码使用常规的
+gRPC 客户端、服务基类、方法描述符、元数据、截止时间、取消和状态码,而请求与响应对象
+使用 Fory(而不是 protobuf)进行序列化。
+
+当 RPC 两端都由同一份 Fory IDL、protobuf IDL 或 FlatBuffers IDL 生成,并且双方都
+需要 Fory 编码的消息体时,请使用此模式。对于必须供通用 protobuf 客户端、反射工具或
+其他要求 protobuf 消息字节的组件使用的 API,请采用常规的 protobuf gRPC 代码生成。
... 43411 lines suppressed ...
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org