diff --git a/website/docs/en/guide/what_is_yalantinglibs.md b/website/docs/en/guide/what_is_yalantinglibs.md index 17430be45..6b0798e99 100644 --- a/website/docs/en/guide/what_is_yalantinglibs.md +++ b/website/docs/en/guide/what_is_yalantinglibs.md @@ -155,7 +155,7 @@ More examples [here](https://github.com/alibaba/yalantinglibs/tree/main/src/coro Based on compile-time reflection, very easy to use, high performance serialization library, struct_pack is a header only library, it is used by coro_rpc now. -Only one line code to finish serialization and deserialization, 10-50x faster than protobuf. +Only one line code to finish serialization and deserialization, 2-50x faster than protobuf. [English Introduction](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_intro.html) diff --git a/website/docs/en/index.md b/website/docs/en/index.md index 9897e4980..b64dd5577 100644 --- a/website/docs/en/index.md +++ b/website/docs/en/index.md @@ -17,7 +17,7 @@ hero: features: - title: struct_pack - details: Only one line code to finish serialization and deserialization, 10-50x faster than protobuf. + details: Only one line code to finish serialization and deserialization, 2-50x faster than protobuf. - title: coro_rpc details: Very easy-to-use, coroutine-based, high performance rpc framework with C++20, more than 2000w qps in echo scene. - title: struct_json diff --git a/website/docs/en/struct_pack/struct_pack_tips.md b/website/docs/en/struct_pack/struct_pack_tips.md index da163da8c..9910a1dd5 100644 --- a/website/docs/en/struct_pack/struct_pack_tips.md +++ b/website/docs/en/struct_pack/struct_pack_tips.md @@ -20,7 +20,7 @@ This document introcude some tips about struct_pack struct_pack will generate a name for the serialized type during compilation, and get a 32-bit MD5 based on the string, then take its upper 31 bits for type check. When deserializing, it will check whether the hash code stored is the same as the type to be deserialized. In order to alleviate possible hash collisions, in debug mode, struct_pack will store the complete type name instead of hash code. Therefore, the binary size in debug mode is slightly larger than release. ## Type requires -1. The user defined struct type should be aggregated. (`std::is_aggregate_v == true`)。 -2. The type to serialize should be legal struct_pack type.。See document:[struct_pack type system](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_type_system.html)。 -3. struct_pack support update protocol by add struct_pack::compatible field, which is forward backward compatibility. User should make sure the version number is increment for each update. It's not allow to delete/modify exist field. See : [document](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_type_system.html#%E5%85%BC%E5%AE%B9%E7%B1%BB%E5%9E%8B) + +1. The type to serialize should be legal struct_pack type.。See document:[struct_pack type system](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_type_system.html)。 +2. struct_pack support update protocol by add struct_pack::compatible field, which is forward backward compatibility. User should make sure the version number is increment for each update. It's not allow to delete/modify exist field. See : [document](https://alibaba.github.io/yalantinglibs/en/struct_pack/struct_pack_type_system.html#%E5%85%BC%E5%AE%B9%E7%B1%BB%E5%9E%8B) diff --git a/website/docs/zh/index.md b/website/docs/zh/index.md index 960dfcb11..e81eb114f 100644 --- a/website/docs/zh/index.md +++ b/website/docs/zh/index.md @@ -17,7 +17,7 @@ hero: features: - title: struct_pack - details: 只需要一行代码完成序列化和反序列化, 比 protobuf 快 10-50 倍. + details: 只需要一行代码完成序列化和反序列化, 比 protobuf 快 2-50 倍. - title: coro_rpc details: Very easy-to-use, coroutine-based, high performance rpc framework with C++20, more than 2000w qps in echo scene. - title: struct_json diff --git a/website/docs/zh/struct_pack/struct_pack_tips.md b/website/docs/zh/struct_pack/struct_pack_tips.md index cdb7313dd..48c906165 100644 --- a/website/docs/zh/struct_pack/struct_pack_tips.md +++ b/website/docs/zh/struct_pack/struct_pack_tips.md @@ -20,7 +20,7 @@ struct_pack在编译期会根据被序列化的对象的类型生成类型字符串,并根据该字符串生成一个32位的MD5并取其高31位作为类型校验码。反序列化时会检查校验码是否和待反序列化的类型相同。 为了缓解可能出现的哈希冲突,在debug模式下,struct_pack会存储完整的类型字符串。因此debug模式下生成的二进制体积比release略大。 ## 类型约束 -1. struct_pack目前要求,用户自定义的结构体类型必须是聚合类(`std::is_aggregate_v == true`)。 -2. 序列化的类型必须是struct_pack类型系统中的合法类型。详见:struct_pack的类型系统。See document:[struct_pack 类型系统](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html)。 -3. struct_pack允许新增struct_pack::compatible字段,并保证其前向/后向的兼容性,只要每次协议变更时填入的版本号大于上一次的版本号即可。如果删除/修改了已有字段,则无法保证兼容性。详见[文档](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html#%E5%85%BC%E5%AE%B9%E7%B1%BB%E5%9E%8B) + +1. 序列化的类型必须是struct_pack类型系统中的合法类型。详见:struct_pack的类型系统。See document:[struct_pack 类型系统](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html)。 +2. struct_pack允许新增struct_pack::compatible字段,并保证其前向/后向的兼容性,只要每次协议变更时填入的版本号大于上一次的版本号即可。如果删除/修改了已有字段,则无法保证兼容性。详见[文档](https://alibaba.github.io/yalantinglibs/zh/struct_pack/struct_pack_type_system.html#%E5%85%BC%E5%AE%B9%E7%B1%BB%E5%9E%8B)