Skip to content

djkoloski/rust_serialization_benchmark

Repository files navigation

Rust serialization benchmark

The goal of these benchmarks is to provide thorough and complete benchmarks for various rust serialization frameworks.

These benchmarks are a work in progress

These benchmarks are still being developed and pull requests to improve benchmarks are welcome.

Calculate the number of messages per second that can be sent/received with various rust serialization frameworks and compression libraries. Documentation

Format

All tests benchmark the following properties (time or size):

  • Serialize: serialize data into a buffer
  • Deserialize: deserializes a buffer into a normal rust object
  • Borrow: deserializes a buffer into a rust object that borrows string data from the input, with lifetime
  • Size: the size of the buffer when serialized
  • Zlib: the size of the buffer after zlib compression
  • Zstd: the size of the buffer after zstd compression
  • Zstd Time: the time taken to compress the serialized buffer with zstd

Zero-copy deserialization libraries have an additional set of benchmarks:

  • Access: accesses a buffer as structured data
  • Read: runs through a buffer and reads fields out of it
  • Update: updates a buffer as structured data

Some benchmark results may be italicized and followed by an asterisk. Mouse over these for more details on what situation was benchmarked. Other footnotes are located at the bottom.

Last updated: 2025-02-20 18:31:20

Runtime info

rustc version

rustc 1.87.0-nightly (f280acf4c 2025-02-19)
binary: rustc
commit-hash: f280acf4c743806abbbbcfe65050ac52ec4bdec0
commit-date: 2025-02-19
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0

CPU info

Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        48 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               4
On-line CPU(s) list:                  0-3
Vendor ID:                            AuthenticAMD
Model name:                           AMD EPYC 7763 64-Core Processor
CPU family:                           25
Model:                                1
Thread(s) per core:                   2
Core(s) per socket:                   2
Socket(s):                            1
Stepping:                             1
BogoMIPS:                             4890.85
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves user_shstk clzero xsaveerptr rdpru arat npt nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload umip vaes vpclmulqdq rdpid fsrm
Virtualization:                       AMD-V
Hypervisor vendor:                    Microsoft
Virtualization type:                  full
L1d cache:                            64 KiB (2 instances)
L1i cache:                            64 KiB (2 instances)
L2 cache:                             1 MiB (2 instances)
L3 cache:                             32 MiB (1 instance)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-3
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Vulnerable: Safe RET, no microcode
Vulnerability Spec store bypass:      Vulnerable
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Retpolines; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

log

This data set is composed of HTTP request logs that are small and contain many strings.

Raw data

For operations, time per iteration; for size, bytes. Lower is better.

Serialize / deserialize speed and size

Crate Serialize Deserialize Borrow Size Zlib Zstd Zstd Time
bilrost 0.1012.2 474.94 µs* 446.29 µs* 2.5734 ms 857.11 µs 804955 328941 285485 4.6030 ms
bincode 2.0.0-rc 301.23 µs 2.4302 ms 741295 303944 257153 3.8977 ms
bincode 1.3.3 548.53 µs 2.0657 ms 589.28 µs 1045784 373127 311761 4.8078 ms
bitcode 0.6.4 138.44 µs 1.4687 ms 62.308 µs 703710 288826 229755 2.4965 ms
borsh 1.5.3 548.64 µs 2.1746 ms 885780 362204 286514 4.4255 ms
capnp 0.20.3 504.31 µs 1443216 513986 428649 6.3161 ms
cbor4ii 0.3.3 655.06 µs 5.1435 ms 3.3678 ms 1407835 403440 324081 4.7380 ms
ciborium 0.2.2 4.0283 ms 12.237 ms 1407835 403440 324081 4.7938 ms
databuf 0.5.0 263.62 µs 2.0038 ms 630.72 µs 765778 311715 264630 3.9106 ms
dlhn 0.1.7 730.71 µs 2.5579 ms 724953 301446 253629 3.6063 ms
flatbuffers 24.12.23 1.0180 ms 1276368 468539 388832 5.1587 ms
minicbor 0.25.1 606.71 µs 2.9800 ms 1.3321 ms 817830 332671 284548 4.2994 ms
msgpacker 0.4.5 1.2386 ms 2.5076 ms 764996 315291 264898 3.8831 ms
nachricht-serde 0.4.0 5.4001 ms 4.3079 ms 2.7711 ms 818669 332556 285514 4.3047 ms
nanoserde 0.1.37 242.83 µs 2.0592 ms 1045784 373127 311761 4.4943 ms
parity-scale-codec 3.6.12 670.17 µs 2.1830 ms 765778 311743 264518 3.8225 ms
postcard 1.1.1 437.40 µs 2.2670 ms 926.47 µs 724953 302399 253747 3.6052 ms
pot 3.0.1 2.4701 ms 6.3558 ms 4.8783 ms 971922 372513 304122 4.6443 ms
prost 0.13.4 936.13 µs* 2.4318 ms* 3.2750 ms 884628 363130 315494 5.0847 ms
protobuf 3.7.1 1.3641 ms* 3.1401 ms* 3.7692 ms 884628 363130 315494 4.8062 ms
rkyv 0.8.9 244.35 µs 1.5483 ms* 1.9339 ms* 1011488 393526 326517 4.9700 ms
rmp-serde 1.3.0 1.3658 ms 3.0526 ms 1.4006 ms 784997 325384 278219 4.1741 ms
ron 0.8.1 11.807 ms 15.168 ms 13.231 ms 1607459 449158 349713 5.7508 ms
savefile 0.18.5 191.99 µs 2.1507 ms 1045800 373139 311761 4.5057 ms
serde-brief 0.1.0 1.5459 ms 4.9937 ms 3.0843 ms 1584946 413733 341439 4.9845 ms
serde_bare 0.5.0 690.81 µs 2.0715 ms 765778 311715 264630 3.8299 ms
serde_cbor 0.11.2 2.0715 ms 4.8660 ms 3.2975 ms 1407835 403440 324081 4.7289 ms
serde_json 1.0.134 3.8698 ms 5.8965 ms 1827461 470560 361090 5.6681 ms
simd-json 0.14.3 2.1452 ms 4.6952 ms 1827461 470560 361090 5.6488 ms
speedy 0.8.7 196.91 µs 1.7452 ms 366.22 µs 885780 362204 286514 4.2836 ms

Zero-copy deserialization speed

Crate Access Read Update
capnp 0.20.3 73.556 ns* 172.25 µs*
flatbuffers 24.12.23 2.5002 ns* 1.9583 ms* 49.342 µs* 2.0607 ms*
rkyv 0.8.9 1.2427 ns* 382.90 µs* 10.486 µs* 392.90 µs* 7.4965 µs*

Comparison

Relative to best. Higher is better.

Serialize / deserialize speed and size

Crate Serialize Deserialize Borrow Size Zlib Zstd Zstd Time
bilrost 0.1012.2 29.15%* 31.02%* 57.07% 7.27% 87.42% 87.80% 80.48% 54.24%
bincode 2.0.0-rc 45.96% 60.44% 94.93% 95.03% 89.35% 64.05%
bincode 1.3.3 25.24% 71.10% 10.57% 67.29% 77.41% 73.70% 51.93%
bitcode 0.6.4 100.00% 100.00% 100.00% 100.00% 100.00% 100.00% 100.00%
borsh 1.5.3 25.23% 67.54% 79.45% 79.74% 80.19% 56.41%
capnp 0.20.3 27.45% 48.76% 56.19% 53.60% 39.53%
cbor4ii 0.3.3 21.13% 28.55% 1.85% 49.99% 71.59% 70.89% 52.69%
ciborium 0.2.2 3.44% 12.00% 49.99% 71.59% 70.89% 52.08%
databuf 0.5.0 52.51% 73.30% 9.88% 91.89% 92.66% 86.82% 63.84%
dlhn 0.1.7 18.95% 57.42% 97.07% 95.81% 90.59% 69.23%
flatbuffers 24.12.23 13.60% 55.13% 61.64% 59.09% 48.39%
minicbor 0.25.1 22.82% 49.29% 4.68% 86.05% 86.82% 80.74% 58.07%
msgpacker 0.4.5 11.18% 58.57% 91.99% 91.61% 86.73% 64.29%
nachricht-serde 0.4.0 2.56% 34.09% 2.25% 85.96% 86.85% 80.47% 57.99%
nanoserde 0.1.37 57.01% 71.32% 67.29% 77.41% 73.70% 55.55%
parity-scale-codec 3.6.12 20.66% 67.28% 91.89% 92.65% 86.86% 65.31%
postcard 1.1.1 31.65% 64.79% 6.73% 97.07% 95.51% 90.54% 69.25%
pot 3.0.1 5.60% 23.11% 1.28% 72.40% 77.53% 75.55% 53.75%
prost 0.13.4 14.79%* 5.69%* 44.85% 79.55% 79.54% 72.82% 49.10%
protobuf 3.7.1 10.15%* 4.41%* 38.97% 79.55% 79.54% 72.82% 51.94%
rkyv 0.8.9 56.66% 94.86%* 75.94%* 69.57% 73.39% 70.37% 50.23%
rmp-serde 1.3.0 10.14% 48.11% 4.45% 89.64% 88.76% 82.58% 59.81%
ron 0.8.1 1.17% 9.68% 0.47% 43.78% 64.30% 65.70% 43.41%
savefile 0.18.5 72.11% 68.29% 67.29% 77.40% 73.70% 55.41%
serde-brief 0.1.0 8.96% 29.41% 2.02% 44.40% 69.81% 67.29% 50.09%
serde_bare 0.5.0 20.04% 70.90% 91.89% 92.66% 86.82% 65.18%
serde_cbor 0.11.2 6.68% 30.18% 1.89% 49.99% 71.59% 70.89% 52.79%
serde_json 1.0.134 3.58% 24.91% 38.51% 61.38% 63.63% 44.04%
simd-json 0.14.3 6.45% 31.28% 38.51% 61.38% 63.63% 44.20%
speedy 0.8.7 70.31% 84.16% 17.01% 79.45% 79.74% 80.19% 58.28%

Zero-copy deserialization speed

Crate Access Read Update
capnp 0.20.3 1.69%* 6.09%*
flatbuffers 24.12.23 49.70%* 0.00%* 21.25%* 0.51%*
rkyv 0.8.9 100.00%* 0.00%* 100.00%* 2.67%* 100.00%*

mesh

This data set is a single mesh. The mesh contains an array of triangles, each of which has three vertices and a normal vector.

Raw data

For operations, time per iteration; for size, bytes. Lower is better.

Serialize / deserialize speed and size

Crate Serialize Deserialize Size Zlib Zstd Zstd Time
bilrost 0.1012.2 6.7233 ms* 8.9657 ms* 8.3714 ms 8625005 6443961 6231572 68.839 ms
bincode 2.0.0-rc 2.4117 ms 1.0223 ms 6000005 5378497 5345897 7.5271 ms
bincode 1.3.3 5.1520 ms 5.8994 ms 6000008 5378500 5345890 7.0102 ms
bitcode 0.6.4 1.3938 ms 794.70 µs 6000006 5182295 4923880 12.521 ms
borsh 1.5.3 6.2914 ms 4.2603 ms 6000004 5378496 5345889 7.5135 ms
capnp 0.20.3 6.2878 ms 14000088 7130367 6051062 81.204 ms
cbor4ii 0.3.3 9.8812 ms 50.827 ms 13125016 7524114 6757967 88.959 ms
ciborium 0.2.2 69.880 ms 120.86 ms 13122324 7524660 6759658 89.379 ms
databuf 0.5.0 2.4065 ms 5.3528 ms 6000003 5378495 5345900 7.5824 ms
dlhn 0.1.7 6.2063 ms 6.7919 ms 6000003 5378495 5345900 7.5545 ms
flatbuffers 24.12.23 872.37 µs 6000024 5378434 5345910 7.5338 ms
minicbor 0.25.1 6.0573 ms 11.850 ms 8125006 6494907 6390894 69.074 ms
msgpacker 0.4.5 19.564 ms 5.2842 ms 7500005 6058442 6014337 9.5015 ms
nachricht-serde 0.4.0 121.57 ms 32.982 ms 8125037 6493484 6386940 69.735 ms
nanoserde 0.1.37 1.3898 ms 1.1080 ms 6000008 5378500 5345890 7.5527 ms
parity-scale-codec 3.6.12 4.7123 ms 2.8215 ms 6000004 5378496 5345889 7.3189 ms
postcard 1.1.1 509.51 µs 1.2481 ms 6000003 5378495 5345900 7.6260 ms
pot 3.0.1 40.094 ms 70.894 ms 10122342 6814618 6852251 81.385 ms
prost 0.13.4 7.7933 ms* 8.4843 ms* 16.070 ms 8750000 6665735 6421871 71.486 ms
protobuf 3.7.1 14.336 ms* 30.963 ms* 28.770 ms 8750000 6665735 6421871 77.149 ms
rkyv 0.8.9 147.70 µs 158.09 µs* 196.86 µs* 6000008 5378500 5345892 7.5323 ms
rmp-serde 1.3.0 15.397 ms 17.781 ms 8125006 6494876 6391037 69.993 ms
ron 0.8.1 172.40 ms 234.81 ms 22192885 8970395 8138755 148.72 ms
savefile 0.18.5 197.80 µs 197.41 µs 6000024 5378519 5345892 7.4873 ms
serde-brief 0.1.0 23.322 ms 35.475 ms 15750015 8024540 6816643 93.191 ms
serde_bare 0.5.0 5.1886 ms 4.8217 ms 6000003 5378495 5345900 7.5254 ms
serde_cbor 0.11.2 35.937 ms 46.933 ms 13122324 7524660 6759658 89.208 ms
serde_json 1.0.134 89.388 ms 87.406 ms 26192883 9566084 8586741 154.77 ms
simd-json 0.14.3 51.567 ms 69.332 ms 26192883 9566084 8586741 155.24 ms
speedy 0.8.7 196.96 µs 197.48 µs 6000004 5378496 5345889 7.4693 ms

Zero-copy deserialization speed

Crate Access Read Update
capnp 0.20.3 101.53 ns* 2.2888 ms*
flatbuffers 24.12.23 2.4752 ns* 40.482 ns* 52.537 µs* 77.803 µs*
rkyv 0.8.9 1.2430 ns* 5.2934 ns* 38.873 µs* 38.889 µs* 99.368 µs*

Comparison

Relative to best. Higher is better.

Serialize / deserialize speed and size

Crate Serialize Deserialize Size Zlib Zstd Zstd Time
bilrost 0.1012.2 2.20%* 1.65%* 1.89% 69.57% 80.42% 79.02% 10.18%
bincode 2.0.0-rc 6.12% 15.46% 100.00% 96.35% 92.11% 93.13%
bincode 1.3.3 2.87% 2.68% 100.00% 96.35% 92.11% 100.00%
bitcode 0.6.4 10.60% 19.89% 100.00% 100.00% 100.00% 55.99%
borsh 1.5.3 2.35% 3.71% 100.00% 96.35% 92.11% 93.30%
capnp 0.20.3 2.35% 42.86% 72.68% 81.37% 8.63%
cbor4ii 0.3.3 1.49% 0.31% 45.71% 68.88% 72.86% 7.88%
ciborium 0.2.2 0.21% 0.13% 45.72% 68.87% 72.84% 7.84%
databuf 0.5.0 6.14% 2.95% 100.00% 96.35% 92.11% 92.45%
dlhn 0.1.7 2.38% 2.33% 100.00% 96.35% 92.11% 92.80%
flatbuffers 24.12.23 16.93% 100.00% 96.35% 92.11% 93.05%
minicbor 0.25.1 2.44% 1.33% 73.85% 79.79% 77.05% 10.15%
msgpacker 0.4.5 0.75% 2.99% 80.00% 85.54% 81.87% 73.78%
nachricht-serde 0.4.0 0.12% 0.48% 73.85% 79.81% 77.09% 10.05%
nanoserde 0.1.37 10.63% 14.27% 100.00% 96.35% 92.11% 92.82%
parity-scale-codec 3.6.12 3.13% 5.60% 100.00% 96.35% 92.11% 95.78%
postcard 1.1.1 28.99% 12.67% 100.00% 96.35% 92.11% 91.92%
pot 3.0.1 0.37% 0.22% 59.27% 76.05% 71.86% 8.61%
prost 0.13.4 1.90%* 1.74%* 0.98% 68.57% 77.75% 76.67% 9.81%
protobuf 3.7.1 1.03%* 0.48%* 0.55% 68.57% 77.75% 76.67% 9.09%
rkyv 0.8.9 100.00% 100.00%* 80.31%* 100.00% 96.35% 92.11% 93.07%
rmp-serde 1.3.0 0.96% 0.89% 73.85% 79.79% 77.04% 10.02%
ron 0.8.1 0.09% 0.07% 27.04% 57.77% 60.50% 4.71%
savefile 0.18.5 74.67% 80.08% 100.00% 96.35% 92.11% 93.63%
serde-brief 0.1.0 0.63% 0.45% 38.10% 64.58% 72.23% 7.52%
serde_bare 0.5.0 2.85% 3.28% 100.00% 96.35% 92.11% 93.15%
serde_cbor 0.11.2 0.41% 0.34% 45.72% 68.87% 72.84% 7.86%
serde_json 1.0.134 0.17% 0.18% 22.91% 54.17% 57.34% 4.53%
simd-json 0.14.3 0.29% 0.23% 22.91% 54.17% 57.34% 4.52%
speedy 0.8.7 74.99% 80.05% 100.00% 96.35% 92.11% 93.85%

Zero-copy deserialization speed

Crate Access Read Update
capnp 0.20.3 1.22%* 1.70%*
flatbuffers 24.12.23 50.22%* 3.07%* 73.99%* 49.96%*
rkyv 0.8.9 100.00%* 23.48%* 100.00%* 99.96%* 100.00%*

minecraft_savedata

This data set is composed of Minecraft player saves that contain highly structured data.

Raw data

For operations, time per iteration; for size, bytes. Lower is better.

Serialize / deserialize speed and size

Crate Serialize Deserialize Borrow Size Zlib Zstd Zstd Time
bilrost 0.1012.2 957.76 µs* 837.03 µs* 3.0846 ms 1.7399 ms 489348 281173 249546 3.1024 ms
bincode 2.0.0-rc 287.08 µs 2.0797 ms 367413 221291 206273 2.4914 ms
bincode 1.3.3 602.67 µs 1.8132 ms 857.32 µs 569975 240525 232423 2.9112 ms
bitcode 0.6.4 126.09 µs 1.2560 ms 169.26 µs 327688 200947 182736 754.36 µs
borsh 1.5.3 562.31 µs 1.8343 ms 446595 234236 210008 2.4856 ms
capnp 0.20.3 439.80 µs 803896 335606 280851 3.9318 ms
cbor4ii 0.3.3 806.52 µs 4.8122 ms 3.5182 ms 1109831 344745 274514 3.8310 ms
ciborium 0.2.2 3.7447 ms 10.537 ms 1109821 344751 274526 3.8201 ms
databuf 0.5.0 318.04 µs 1.7296 ms 780.68 µs 356311 213062 198488 2.4366 ms
dlhn 0.1.7 779.31 µs 2.6022 ms 366496 220600 205683 2.5168 ms
flatbuffers 24.12.23 3.2402 ms 844168 345696 294015 3.8600 ms
minicbor 0.25.1 553.88 µs 3.3289 ms 1.8685 ms 428773 249857 228741 2.7303 ms
msgpacker 0.4.5 1.0039 ms 2.8355 ms 391251 236877 220476 2.7116 ms
nachricht-serde 0.4.0 5.1026 ms 4.1376 ms 2.9329 ms 449745 252432 231110 2.7702 ms
nanoserde 0.1.37 268.97 µs 1.9349 ms 567975 239930 232419 2.9129 ms
parity-scale-codec 3.6.12 636.40 µs 1.9453 ms 356311 212976 198524 2.4160 ms
postcard 1.1.1 448.28 µs 2.0913 ms 816.37 µs 367489 221913 207344 2.4995 ms
pot 3.0.1 2.4218 ms 6.3198 ms 5.0233 ms 599125 299158 247693 3.1413 ms
prost 0.13.4 1.2812 ms* 2.9837 ms* 3.4317 ms 596811 305319 269310 3.4355 ms
protobuf 3.7.1 1.0429 ms* 2.9872 ms* 3.8237 ms 596811 305319 269310 3.4404 ms
rkyv 0.8.9 347.50 µs 1.5043 ms* 1.8900 ms* 603776 254776 220087 2.7488 ms
rmp-serde 1.3.0 1.4933 ms 3.0326 ms 1.6933 ms 424533 245214 226188 2.7246 ms
ron 0.8.1 7.3571 ms 17.125 ms 15.276 ms 1465223 434935 343338 5.8321 ms
savefile 0.18.5 214.69 µs 1.8398 ms 566991 239362 232010 2.9051 ms
serde-brief 0.1.0 1.3407 ms 5.3868 ms 3.8023 ms 1276014 373898 293679 4.0413 ms
serde_bare 0.5.0 742.90 µs 2.3338 ms 356311 213062 198488 2.4574 ms
serde_cbor 0.11.2 1.8694 ms 4.8686 ms 3.4467 ms 1109821 344751 274526 3.8391 ms
serde_json 1.0.134 3.6633 ms 6.6995 ms 1623191 466527 359623 6.0276 ms
simd-json 0.14.3 2.2546 ms 4.5958 ms 1623191 466527 359623 6.0347 ms
speedy 0.8.7 261.66 µs 1.6987 ms 565.80 µs 449595 234970 210361 2.5060 ms

Zero-copy deserialization speed

Crate Access Read Update
capnp 0.20.3 71.828 ns* 489.93 ns*
flatbuffers 24.12.23 2.4853 ns* 2.1843 ms* 1.3521 µs* 2.1927 ms*
rkyv 0.8.9 1.2429 ns* 378.82 µs* 240.21 ns* 379.59 µs* 768.48 ns*

Comparison

Relative to best. Higher is better.

Serialize / deserialize speed and size

Crate Serialize Deserialize Borrow Size Zlib Zstd Zstd Time
bilrost 0.1012.2 13.17%* 15.06%* 40.72% 9.73% 66.96% 71.47% 73.23% 24.32%
bincode 2.0.0-rc 43.92% 60.39% 89.19% 90.81% 88.59% 30.28%
bincode 1.3.3 20.92% 69.27% 19.74% 57.49% 83.55% 78.62% 25.91%
bitcode 0.6.4 100.00% 100.00% 100.00% 100.00% 100.00% 100.00% 100.00%
borsh 1.5.3 22.42% 68.47% 73.37% 85.79% 87.01% 30.35%
capnp 0.20.3 28.67% 40.76% 59.88% 65.07% 19.19%
cbor4ii 0.3.3 15.63% 26.10% 4.81% 29.53% 58.29% 66.57% 19.69%
ciborium 0.2.2 3.37% 11.92% 29.53% 58.29% 66.56% 19.75%
databuf 0.5.0 39.65% 72.62% 21.68% 91.97% 94.31% 92.06% 30.96%
dlhn 0.1.7 16.18% 48.27% 89.41% 91.09% 88.84% 29.97%
flatbuffers 24.12.23 3.89% 38.82% 58.13% 62.15% 19.54%
minicbor 0.25.1 22.76% 37.73% 9.06% 76.42% 80.42% 79.89% 27.63%
msgpacker 0.4.5 12.56% 44.30% 83.75% 84.83% 82.88% 27.82%
nachricht-serde 0.4.0 2.47% 30.36% 5.77% 72.86% 79.60% 79.07% 27.23%
nanoserde 0.1.37 46.88% 64.91% 57.69% 83.75% 78.62% 25.90%
parity-scale-codec 3.6.12 19.81% 64.57% 91.97% 94.35% 92.05% 31.22%
postcard 1.1.1 28.13% 60.06% 20.73% 89.17% 90.55% 88.13% 30.18%
pot 3.0.1 5.21% 19.87% 3.37% 54.69% 67.17% 73.78% 24.01%
prost 0.13.4 9.84%* 4.23%* 36.60% 54.91% 65.82% 67.85% 21.96%
protobuf 3.7.1 12.09%* 4.22%* 32.85% 54.91% 65.82% 67.85% 21.93%
rkyv 0.8.9 36.28% 83.49%* 66.46%* 54.27% 78.87% 83.03% 27.44%
rmp-serde 1.3.0 8.44% 41.42% 10.00% 77.19% 81.95% 80.79% 27.69%
ron 0.8.1 1.71% 7.33% 1.11% 22.36% 46.20% 53.22% 12.93%
savefile 0.18.5 58.73% 68.27% 57.79% 83.95% 78.76% 25.97%
serde-brief 0.1.0 9.40% 23.32% 4.45% 25.68% 53.74% 62.22% 18.67%
serde_bare 0.5.0 16.97% 53.82% 91.97% 94.31% 92.06% 30.70%
serde_cbor 0.11.2 6.74% 25.80% 4.91% 29.53% 58.29% 66.56% 19.65%
serde_json 1.0.134 3.44% 18.75% 20.19% 43.07% 50.81% 12.52%
simd-json 0.14.3 5.59% 27.33% 20.19% 43.07% 50.81% 12.50%
speedy 0.8.7 48.19% 73.94% 29.92% 72.89% 85.52% 86.87% 30.10%

Zero-copy deserialization speed

Crate Access Read Update
capnp 0.20.3 1.73%* 49.03%*
flatbuffers 24.12.23 50.01%* 0.00%* 17.77%* 0.01%*
rkyv 0.8.9 100.00%* 0.00%* 100.00%* 0.06%* 100.00%*

mk48

This data set is composed of mk48.io game updates that contain data with many exploitable patterns and invariants.

Raw data

For operations, time per iteration; for size, bytes. Lower is better.

Serialize / deserialize speed and size

Crate Serialize Deserialize Size Zlib Zstd Zstd Time
bilrost 0.1012.2 4.5154 ms* 2.5849 ms* 8.3828 ms 1704643 1294259 1245607 11.339 ms
bincode 2.0.0-rc 1.1828 ms 4.0441 ms 1406257 1117802 1062238 9.3659 ms
bincode 1.3.3 3.9069 ms 4.1993 ms 1854234 1141994 1050351 10.136 ms
bitcode 0.6.4 723.85 µs 2.3341 ms 971318 878034 855922 3.3702 ms
borsh 1.5.3 2.9286 ms 2.8630 ms 1521989 1108471 1038408 9.7511 ms
capnp 0.20.3 2.2130 ms 2724288 1546992 1240354 14.655 ms
cbor4ii 0.3.3 3.0635 ms 18.504 ms 6012539 1695215 1467194 21.515 ms
ciborium 0.2.2 22.365 ms 56.454 ms 6012373 1695146 1467435 21.491 ms
databuf 0.5.0 1.3063 ms 3.8033 ms 1319999 1062631 1007898 8.7308 ms
dlhn 0.1.7 4.8017 ms 6.5491 ms 1311281 1077520 1045571 8.5357 ms
flatbuffers 24.12.23 5.1369 ms 2325620 1440289 1265148 13.054 ms
minicbor 0.25.1 2.5029 ms 11.182 ms 1777386 1276218 1252036 12.081 ms
msgpacker 0.4.5 2.3152 ms 6.7999 ms 1458773 1156055 1137194 9.5273 ms
nachricht-serde 0.4.0 30.029 ms 16.708 ms 1770060 1277755 1263142 12.150 ms
nanoserde 0.1.37 1.3016 ms 2.9434 ms 1812404 1134820 1054758 10.308 ms
parity-scale-codec 3.6.12 3.1511 ms 3.1993 ms 1319999 1064380 1010284 8.9829 ms
postcard 1.1.1 2.0100 ms 4.2296 ms 1311281 1083900 1041114 8.5351 ms
pot 3.0.1 14.163 ms 29.703 ms 2604812 1482233 1299952 15.475 ms
prost 0.13.4 5.4198 ms* 10.751 ms* 9.1616 ms 1859886 1338076 1295497 11.927 ms
protobuf 3.7.1 5.4879 ms* 12.576 ms* 11.907 ms 1859886 1338076 1295497 12.015 ms
rkyv 0.8.9 929.06 µs 2.1854 ms* 2.6161 ms* 2075936 1383779 1211892 12.738 ms
rmp-serde 1.3.0 10.610 ms 11.035 ms 1745322 1261627 1228902 11.187 ms
ron 0.8.1 37.095 ms 96.248 ms 8677703 2233642 1827843 33.948 ms
savefile 0.18.5 846.24 µs 2.7291 ms 1791505 1128012 1052757 10.280 ms
serde-brief 0.1.0 6.4119 ms 22.071 ms 6951772 1796265 1570903 23.327 ms
serde_bare 0.5.0 5.4359 ms 4.8226 ms 1319999 1062645 1007918 8.7265 ms
serde_cbor 0.11.2 10.244 ms 21.925 ms 6012373 1695146 1467435 21.241 ms
serde_json 1.0.134 20.788 ms 31.659 ms 9390461 2391679 1843922 34.785 ms
simd-json 0.14.3 11.569 ms 25.736 ms 9390461 2391679 1843922 34.346 ms
speedy 0.8.7 772.93 µs 2.4656 ms 1584734 1119837 1038012 9.9897 ms

Zero-copy deserialization speed

Crate Access Read Update
capnp 0.20.3 73.312 ns* 851.27 ns*
flatbuffers 24.12.23 2.4854 ns* 5.0891 ms* 2.5988 µs* 5.3314 ms*
rkyv 0.8.9 1.2430 ns* 451.46 µs* 409.07 ns* 451.38 µs* 235.04 ns*

Comparison

Relative to best. Higher is better.

Serialize / deserialize speed and size

Crate Serialize Deserialize Size Zlib Zstd Zstd Time
bilrost 0.1012.2 16.03%* 28.00%* 26.07% 56.98% 67.84% 68.72% 29.72%
bincode 2.0.0-rc 61.20% 54.04% 69.07% 78.55% 80.58% 35.98%
bincode 1.3.3 18.53% 52.04% 52.38% 76.89% 81.49% 33.25%
bitcode 0.6.4 100.00% 93.63% 100.00% 100.00% 100.00% 100.00%
borsh 1.5.3 24.72% 76.33% 63.82% 79.21% 82.43% 34.56%
capnp 0.20.3 32.71% 35.65% 56.76% 69.01% 23.00%
cbor4ii 0.3.3 23.63% 11.81% 16.15% 51.79% 58.34% 15.66%
ciborium 0.2.2 3.24% 3.87% 16.16% 51.80% 58.33% 15.68%
databuf 0.5.0 55.41% 57.46% 73.58% 82.63% 84.92% 38.60%
dlhn 0.1.7 15.07% 33.37% 74.07% 81.49% 81.86% 39.48%
flatbuffers 24.12.23 14.09% 41.77% 60.96% 67.65% 25.82%
minicbor 0.25.1 28.92% 19.54% 54.65% 68.80% 68.36% 27.90%
msgpacker 0.4.5 31.27% 32.14% 66.58% 75.95% 75.27% 35.37%
nachricht-serde 0.4.0 2.41% 13.08% 54.87% 68.72% 67.76% 27.74%
nanoserde 0.1.37 55.61% 74.25% 53.59% 77.37% 81.15% 32.70%
parity-scale-codec 3.6.12 22.97% 68.31% 73.58% 82.49% 84.72% 37.52%
postcard 1.1.1 36.01% 51.67% 74.07% 81.01% 82.21% 39.49%
pot 3.0.1 5.11% 7.36% 37.29% 59.24% 65.84% 21.78%
prost 0.13.4 13.36%* 6.73%* 23.85% 52.22% 65.62% 66.07% 28.26%
protobuf 3.7.1 13.19%* 5.76%* 18.35% 52.22% 65.62% 66.07% 28.05%
rkyv 0.8.9 77.91% 100.00%* 83.54%* 46.79% 63.45% 70.63% 26.46%
rmp-serde 1.3.0 6.82% 19.80% 55.65% 69.60% 69.65% 30.13%
ron 0.8.1 1.95% 2.27% 11.19% 39.31% 46.83% 9.93%
savefile 0.18.5 85.54% 80.08% 54.22% 77.84% 81.30% 32.78%
serde-brief 0.1.0 11.29% 9.90% 13.97% 48.88% 54.49% 14.45%
serde_bare 0.5.0 13.32% 45.32% 73.58% 82.63% 84.92% 38.62%
serde_cbor 0.11.2 7.07% 9.97% 16.16% 51.80% 58.33% 15.87%
serde_json 1.0.134 3.48% 6.90% 10.34% 36.71% 46.42% 9.69%
simd-json 0.14.3 6.26% 8.49% 10.34% 36.71% 46.42% 9.81%
speedy 0.8.7 93.65% 88.64% 61.29% 78.41% 82.46% 33.74%

Zero-copy deserialization speed

Crate Access Read Update
capnp 0.20.3 1.70%* 48.05%*
flatbuffers 24.12.23 50.01%* 0.00%* 15.74%* 0.01%*
rkyv 0.8.9 100.00%* 0.00%* 100.00%* 0.09%* 100.00%*

Footnotes:

* mouse over for situational details

this deserialization capability is not supported

buffer mutation is not supported (capnp and flatbuffers may but not for rust)

About

Benchmarks for rust serialization frameworks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages