跳到主要内容
版本:0.17

Rust 基准性能报告

生成于 2026-03-20 18:40:46

如何生成本报告

cd benchmarks/rust
cargo bench --bench serialization_bench 2>&1 | tee results/cargo_bench.log
cargo run --release --bin fory_profiler -- --print-all-serialized-sizes | tee results/serialized_sizes.txt
python benchmark_report.py --log-file results/cargo_bench.log --size-file results/serialized_sizes.txt --output-dir results

硬件与操作系统信息

操作系统Darwin 24.6.0
机器架构arm64
处理器arm
CPU 核心数(物理)12
CPU 核心数(逻辑)12
总内存(GB)48.0
基准日期2026-03-20T18:40:44

基准图表

下列各类图表均展示吞吐量(ops/sec)。

总吞吐量

Throughput

MediaContent

MediaContent

MediaContentList

MediaContentList

Sample

Sample

SampleList

SampleList

Struct

Struct

StructList

StructList

基准结果

延迟结果(纳秒)

数据类型操作fory (ns)protobuf (ns)最快
StructSerialize69.676.8fory
StructDeserialize27.070.4fory
SampleSerialize148.5584.3fory
SampleDeserialize350.9983.1fory
MediaContentSerialize277.8553.2fory
MediaContentDeserialize472.3706.4fory
StructListSerialize170.4385.4fory
StructListDeserialize96.8294.7fory
SampleListSerialize356.23155.7fory
SampleListDeserialize1644.14361.0fory
MediaContentListSerialize657.42844.0fory
MediaContentListDeserialize2397.73696.6fory

吞吐结果(ops/sec)

数据类型操作fory TPSprotobuf TPS最快
StructSerialize14,366,16513,022,359fory
StructDeserialize37,065,86614,202,528fory
SampleSerialize6,734,9141,711,537fory
SampleDeserialize2,849,4091,017,201fory
MediaContentSerialize3,600,2301,807,664fory
MediaContentDeserialize2,117,4331,415,689fory
StructListSerialize5,866,8232,595,043fory
StructListDeserialize10,330,1523,393,051fory
SampleListSerialize2,807,333316,887fory
SampleListDeserialize608,236229,305fory
MediaContentListSerialize1,521,098351,617fory
MediaContentListDeserialize417,066270,519fory

序列化数据大小(字节)

数据类型foryprotobuf
Struct5861
Sample446375
MediaContent365301
StructList184315
SampleList19801890
MediaContentList15351520