跳到主要内容
版本:dev

Fory Swift 基准测试

本基准测试比较 Apache Fory、Protocol Buffers 和 JSON 在 Swift 中的序列化与反序列化吞吐量。

基准测试产物

常规/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
每个测试用例的时长 (s)3

吞吐量结果

数据类型操作Fory TPSProtobuf TPSJSON TPS最快
NumericStruct序列化9,435,6236,175,939408,960fory (1.53x)
NumericStruct反序列化11,037,2256,842,676328,302fory (1.61x)
Sample序列化3,596,8351,257,10079,781fory (2.86x)
Sample反序列化982,255733,58841,274fory (1.34x)
MediaContent序列化1,561,376609,89698,677fory (2.56x)
MediaContent反序列化523,836395,20270,528fory (1.33x)
NumericStructList序列化2,910,846918,36382,965fory (3.17x)
NumericStructList反序列化2,436,636701,65669,353fory (3.47x)
SampleList序列化694,557202,04016,679fory (3.44x)
SampleList反序列化187,109131,9478,236fory (1.42x)
MediaContentList序列化348,23898,00718,698fory (3.55x)
MediaContentList反序列化104,99074,42216,298fory (1.41x)

序列化大小 (bytes)

数据类型ForyProtobufJSON
NumericStruct7893159
Sample445375696
MediaContent362301608
NumericStructList255475816
SampleList197818903501
MediaContentList153115203067