This directory contains two benchmark entrypoints:
benchmark.py+run.sh(new): C++-parity benchmark matrix covering:Struct,Sample,MediaContentStructList,SampleList,MediaContentList- operations:
serialize,deserialize - serializers:
fory,pickle,protobuf
fory_benchmark.py(legacy): existing CPython microbench script kept intact.
cd benchmarks/python
./run.shrun.sh will:
- Generate Python protobuf bindings from
benchmarks/proto/bench.proto - Run
benchmark.py - Generate plots + markdown report via
benchmark_report.py - Copy report/plots to
docs/benchmarks/python
# Run only Struct benchmarks for Fory serialize
./run.sh --data struct --serializer fory --operation serialize
# Run all data types, deserialize only
./run.sh --operation deserialize
# Adjust benchmark loops
./run.sh --warmup 5 --iterations 30 --repeat 8 --number 1500
# Skip docs sync
./run.sh --no-copy-docsSupported values:
--data:struct,sample,mediacontent,structlist,samplelist,mediacontentlist--serializer:fory,pickle,protobuf--operation:all|serialize|deserialize
fory_benchmark.py remains unchanged and can still be used directly:
cd benchmarks/python
python fory_benchmark.pyFor its original options and behavior, refer to python fory_benchmark.py --help.
pyforymust be installed in your current Python environment.protocis required byrun.shto generatebench_pb2.py.protobufbenchmarks include dataclass <-> protobuf conversion in the timed path.