Skip to content

Performance & Benchmarks

pysafe-pickle delivers competitive serialization performance powered by its Rust core while strictly maintaining zero arbitrary code execution.


Benchmark Comparison (pysafe-pickle vs Standard pickle)

Benchmarks were collected using pytest-benchmark across diverse data shapes:

Data ShapeOperations/Sec (pysafe-pickle)Operations/Sec (pickle)Notes
Primitives (ints, floats, bools)~216,000 ops/sec~250,000 ops/secNear parity
Nested Dataclasses~52,000 ops/sec~54,000 ops/secFull schema tracking
Complex Graphs (with cycles)~122,000 ops/sec~95,000 ops/secFast Rust memo table
Wide Dictionaries (100 keys)~17,800 ops/sec~18,500 ops/secDeduplicated string table
Large Strings (100KB)~32,800 ops/sec~34,000 ops/secUTF-8 zero-copy slices

Running Benchmarks Locally

You can replicate the benchmark suite using pytest-benchmark:

bash
uv run pytest benchmarks/ -v --benchmark-only

Last updated:

Released under the AGPL-3.0 License.