Benchmarks for rust serialization frameworks

Overview

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.

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
  • Size: the size of the buffer when serialized
  • Zlib: the size of the buffer after zlib compression

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.

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

Format / Lib Serialize Deserialize Size Zlib
abomonation 296.84 us 1705800 507159
bincode 571.32 us 4.3227 ms 1045784 374305
borsh 662.99 us 4.0850 ms 885780 363280
capnp 1.8191 ms 1843240 537966
cbor 2.5207 ms 8.9012 ms 1407835 407372
flatbuffers 2.6539 ms 1276368 469962
nachricht 4.7305 ms 8.2779 ms 926221 365209
postcard 681.17 us 4.5506 ms 765778 312739
prost 5.4518 ms* 1.5846 ms* 4.9954 ms 764951 269811
rkyv 430.28 us 3.1559 ms 1065784 333895
rmp 1.9255 ms 5.3639 ms 784997 326654
serde_json 4.3754 ms 9.7525 ms 1827461 474358
speedy 228.55 us 3.3615 ms 885780 363280

Zero-copy deserialization speed

Format / Lib Access Read Update
abomonation 37.243 us* 59.472 us*
capnp 249.22 ns* 717.69 us*
flatbuffers 2.9856 ns* 138.93 us*
rkyv 1.3709 ns* 1.4739 ms* 18.593 us* 1.5105 ms* 70.076 us

Comparison

Relative to best. Higher is better.

Serialize / deserialize speed and size

Format / Lib Serialize Deserialize Size Zlib
abomonation 76.99% 44.84% 53.20%
bincode 40.00% 73.01% 73.15% 72.08%
borsh 34.47% 77.26% 86.36% 74.27%
capnp 12.56% 41.50% 50.15%
cbor 9.07% 35.45% 54.34% 66.23%
flatbuffers 8.61% 59.93% 57.41%
nachricht 4.83% 38.12% 82.59% 73.88%
postcard 33.55% 69.35% 99.89% 86.27%
prost 4.19%* 14.42%* 63.18% 100.00% 100.00%
rkyv 53.12% 100.00% 71.77% 80.81%
rmp 11.87% 58.84% 97.45% 82.60%
serde_json 5.22% 32.36% 41.86% 56.88%
speedy 100.00% 93.88% 86.36% 74.27%

Zero-copy deserialization speed

Format / Lib Access Read Update
abomonation 0.00%* 31.26%*
capnp 0.55%* 2.59%*
flatbuffers 45.92%* 13.38%*
rkyv 100.00%* 0.00%* 100.00%* 1.23%* 100.00%

mesh

The 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

Format / Lib Serialize Deserialize Size Zlib
abomonation 427.04 us 6000024 5380836
bincode 6.7946 ms 11.661 ms 6000008 5380823
borsh 6.0806 ms 8.9562 ms 6000004 5380818
capnp 15.223 ms 16000056 6780527
cbor 47.042 ms 67.888 ms 13122324 7527423
flatbuffers 1.9273 ms 6000024 5380800
nachricht 74.686 ms 59.577 ms 10125030 7160144
postcard 6.3430 ms 10.040 ms 6000003 5380817
prost 32.546 ms* 27.934 ms* 19.869 ms 8750000 6683814
rkyv 1.1684 ms 1.8822 ms 6000008 4263104
rmp 21.623 ms 24.912 ms 8125006 6496879
serde_json 106.10 ms 82.661 ms 26192883 9612105
speedy 689.70 us 2.2248 ms 6000004 5380818

Zero-copy deserialization speed

Format / Lib Access Read Update
abomonation 2.3443 ns* 191.67 us*
capnp 243.37 ns* 9.0149 ms*
flatbuffers 2.9152 ns* 186.15 us*
rkyv 1.3414 ns* 106.17 ns* 182.54 us* 190.35 us* 646.96 us

Comparison

Relative to best. Higher is better.

Serialize / deserialize speed and size

Format / Lib Serialize Deserialize Size Zlib
abomonation 100.00% 100.00% 79.23%
bincode 6.28% 16.14% 100.00% 79.23%
borsh 7.02% 21.02% 100.00% 79.23%
capnp 2.81% 37.50% 62.87%
cbor 0.91% 2.77% 45.72% 56.63%
flatbuffers 22.16% 100.00% 79.23%
nachricht 0.57% 3.16% 59.26% 59.54%
postcard 6.73% 18.75% 100.00% 79.23%
prost 1.31%* 1.53%* 9.47% 68.57% 63.78%
rkyv 36.55% 100.00% 100.00% 100.00%
rmp 1.97% 7.56% 73.85% 65.62%
serde_json 0.40% 2.28% 22.91% 44.35%
speedy 61.92% 84.60% 100.00% 79.23%

Zero-copy deserialization speed

Format / Lib Access Read Update
abomonation 57.22%* 95.24%*
capnp 0.55%* 2.02%*
flatbuffers 46.01%* 98.06%*
rkyv 100.00%* 1.26%* 100.00%* 95.90%* 100.00%

minecraft_savedata

The 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

Format / Lib Serialize Deserialize Size Zlib
abomonation 370.92 us 1290592 392868
bincode 799.32 us 3.2997 ms 569975 240897
borsh 798.15 us 3.0107 ms 446595 234395
capnp 862.70 us 835784 342099
cbor 2.6076 ms 8.4790 ms 1109821 347562
flatbuffers 36.830 ms 849472 349208
nachricht 5.0234 ms 7.1360 ms 535881 281994
postcard 784.32 us 3.7493 ms 356311 213270
prost 5.8932 ms* 2.8476 ms* 5.0972 ms 596811 306728
rkyv 844.88 us 2.4668 ms 725176 333931
rmp 2.0772 ms 4.8862 ms 418025 244771
serde_json 4.4648 ms 10.616 ms 1623197 472162
speedy 471.69 us 2.7482 ms 449595 235136

Zero-copy deserialization speed

Format / Lib Access Read Update
abomonation 41.511 us* 42.284 us*
capnp 243.01 ns* 5.5690 us*
flatbuffers 2.9451 ns* 3.5652 us*
rkyv 1.3712 ns* 1.7723 ms* 275.27 ns* 1.7747 ms* 6.4037 us

Comparison

Relative to best. Higher is better.

Serialize / deserialize speed and size

Format / Lib Serialize Deserialize Size Zlib
abomonation 100.00% 27.61% 54.29%
bincode 46.40% 74.76% 62.51% 88.53%
borsh 46.47% 81.93% 79.78% 90.99%
capnp 43.00% 42.63% 62.34%
cbor 14.22% 29.09% 32.11% 61.36%
flatbuffers 1.01% 41.94% 61.07%
nachricht 7.38% 34.57% 66.49% 75.63%
postcard 47.29% 65.79% 100.00% 100.00%
prost 6.29%* 13.03%* 48.40% 59.70% 69.53%
rkyv 43.90% 100.00% 49.13% 63.87%
rmp 17.86% 50.49% 85.24% 87.13%
serde_json 8.31% 23.24% 21.95% 45.17%
speedy 78.64% 89.76% 79.25% 90.70%

Zero-copy deserialization speed

Format / Lib Access Read Update
abomonation 0.00%* 0.65%*
capnp 0.56%* 4.94%*
flatbuffers 46.56%* 7.72%*
rkyv 100.00%* 0.00%* 100.00%* 0.02%* 100.00%

Footnotes:

* mouse over for situational details

do not provide deserialization capabilities, but the user can write their own

do not support buffer mutation (capnp and flatbuffers may but not for rust)

Comments
  • Cannot compile on linux

    Cannot compile on linux

    Hi I tried to run this project after installing capnproto and flatbuffers but I'm getting a bunch of compilation errors while calling cargo bench:

    error[E0432]: unresolved imports `rust_serialization_benchmark::datasets::log::Log`, `rust_serialization_benchmark::datasets::log::Logs`
      --> benches/bench.rs:41:55
       |
    41 |     use rust_serialization_benchmark::datasets::log::{Log, Logs};
       |                                                       ^^^  ^^^^ no `Logs` in `datasets::log`
       |                                                       |
       |                                                       no `Log` in `datasets::log`
       |                                                       help: a similar name exists in the module: `log`
    
    error[E0432]: unresolved import `rust_serialization_benchmark::datasets::log::ArchivedAddress`
       --> benches/bench.rs:140:17
        |
    140 |             use rust_serialization_benchmark::datasets::log::ArchivedAddress;
        |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ArchivedAddress` in `datasets::log`
    
    error[E0432]: unresolved imports `rust_serialization_benchmark::datasets::mesh::Mesh`, `rust_serialization_benchmark::datasets::mesh::Triangle`
       --> benches/bench.rs:188:56
        |
    188 |     use rust_serialization_benchmark::datasets::mesh::{Mesh, Triangle};
        |                                                        ^^^^  ^^^^^^^^ no `Triangle` in `datasets::mesh`
        |                                                        |
        |                                                        no `Mesh` in `datasets::mesh`
        |                                                        help: a similar name exists in the module: `mesh`
    
    error[E0432]: unresolved imports `rust_serialization_benchmark::datasets::minecraft_savedata::Player`, `rust_serialization_benchmark::datasets::minecraft_savedata::Players`
       --> benches/bench.rs:316:70
        |
    316 |     use rust_serialization_benchmark::datasets::minecraft_savedata::{Player, Players};
        |                                                                      ^^^^^^  ^^^^^^^ no `Players` in `datasets::minecraft_savedata`
        |                                                                      |
        |                                                                      no `Player` in `datasets::minecraft_savedata`
    
    error[E0432]: unresolved import `rust_serialization_benchmark::datasets::minecraft_savedata::ArchivedGameType`
       --> benches/bench.rs:404:17
        |
    404 |             use rust_serialization_benchmark::datasets::minecraft_savedata::ArchivedGameType;
        |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ArchivedGameType` in `datasets::minecraft_savedata`
    
    error[E0433]: failed to resolve: could not find `cp` in `log`
      --> benches/bench.rs:79:70
       |
    79 |             .get_root::<rust_serialization_benchmark::datasets::log::cp::logs::Reader>()
       |                                                                      ^^ could not find `cp` in `log`
    
    error[E0433]: failed to resolve: could not find `fb` in `log`
      --> benches/bench.rs:98:62
       |
    98 |                 rust_serialization_benchmark::datasets::log::fb::Logs,
       |                                                              ^^ could not find `fb` in `log`
    
    error[E0433]: failed to resolve: could not find `fb` in `log`
       --> benches/bench.rs:108:82
        |
    108 |                 flatbuffers::root::<rust_serialization_benchmark::datasets::log::fb::Logs>(bytes)
        |                                                                                  ^^ could not find `fb` in `log`
    
    error[E0433]: failed to resolve: could not find `cp` in `mesh`
       --> benches/bench.rs:224:71
        |
    224 |             .get_root::<rust_serialization_benchmark::datasets::mesh::cp::mesh::Reader>()
        |                                                                       ^^ could not find `cp` in `mesh`
    
    error[E0433]: failed to resolve: could not find `fb` in `mesh`
       --> benches/bench.rs:241:63
        |
    241 |                 rust_serialization_benchmark::datasets::mesh::fb::Mesh,
        |                                                               ^^ could not find `fb` in `mesh`
    
    error[E0433]: failed to resolve: could not find `fb` in `mesh`
       --> benches/bench.rs:249:83
        |
    249 |                 flatbuffers::root::<rust_serialization_benchmark::datasets::mesh::fb::Mesh>(bytes)
        |                                                                                   ^^ could not find `fb` in `mesh`
    
    error[E0433]: failed to resolve: could not find `cp` in `minecraft_savedata`
       --> benches/bench.rs:351:106
        |
    351 |         let data = message_reader.get_root::<rust_serialization_benchmark::datasets::minecraft_savedata::cp::players::Reader>().unwrap();
        |                                                                                                          ^^ could not find `cp` in `minecraft_savedata`
    
    error[E0433]: failed to resolve: could not find `fb` in `minecraft_savedata`
       --> benches/bench.rs:367:77
        |
    367 |                 rust_serialization_benchmark::datasets::minecraft_savedata::fb::Players,
        |                                                                             ^^ could not find `fb` in `minecraft_savedata`
    
    error[E0433]: failed to resolve: could not find `fb` in `minecraft_savedata`
       --> benches/bench.rs:375:77
        |
    375 |                 rust_serialization_benchmark::datasets::minecraft_savedata::fb::Players,
        |                                                                             ^^ could not find `fb` in `minecraft_savedata`
    
    error[E0412]: cannot find type `LogsSchema` in module `rust_serialization_benchmark::datasets::log`
       --> benches/bench.rs:178:79
        |
    178 |     data: alkahest::Unpacked<'a, rust_serialization_benchmark::datasets::log::LogsSchema>,
        |                                                                               ^^^^^^^^^^ not found in `rust_serialization_benchmark::datasets::log`
    
    error[E0412]: cannot find type `MeshSchema` in module `rust_serialization_benchmark::datasets::mesh`
       --> benches/bench.rs:308:80
        |
    308 |     mesh: alkahest::Unpacked<'a, rust_serialization_benchmark::datasets::mesh::MeshSchema>,
        |                                                                                ^^^^^^^^^^ not found in `rust_serialization_benchmark::datasets::mesh`
    
    error[E0412]: cannot find type `PlayersSchema` in module `rust_serialization_benchmark::datasets::minecraft_savedata`
       --> benches/bench.rs:439:69
        |
    439 |         rust_serialization_benchmark::datasets::minecraft_savedata::PlayersSchema,
        |                                                                     ^^^^^^^^^^^^^ not found in `rust_serialization_benchmark::datasets::minecraft_savedata`
    
    error[E0609]: no field `logs` on type `&_`
      --> benches/bench.rs:58:25
       |
    58 |         for log in data.logs.iter() {
       |                         ^^^^
    
    error[E0609]: no field `logs` on type `&_`
       --> benches/bench.rs:133:29
        |
    133 |             for log in data.logs.iter() {
        |                             ^^^^
    
    error[E0599]: no method named `as_ref` found for struct `Pin<&mut _>` in the current scope
       --> benches/bench.rs:142:30
        |
    142 |             for i in 0..logs.as_ref().logs.len() {
        |                              ^^^^^^ method not found in `Pin<&mut _>`
        |
        = note: the method was found for
                - `Pin<P>`
        = note: `logs` is a function, perhaps you wish to call it
    
    error[E0599]: no method named `as_mut` found for struct `Pin<&mut _>` in the current scope
       --> benches/bench.rs:143:36
        |
    143 |                 let mut log = logs.as_mut().logs_pin().index_pin(i);
        |                                    ^^^^^^ method not found in `Pin<&mut _>`
        |
        = note: the method was found for
                - `Pin<P>`
        = note: `logs` is a function, perhaps you wish to call it
    
    error[E0609]: no field `triangles` on type `&_`
       --> benches/bench.rs:205:30
        |
    205 |         for triangle in data.triangles.iter() {
        |                              ^^^^^^^^^
    
    error[E0609]: no field `triangles` on type `&_`
       --> benches/bench.rs:272:34
        |
    272 |             for triangle in mesh.triangles.iter() {
        |                                  ^^^^^^^^^
    
    error[E0599]: no method named `as_ref` found for struct `Pin<&mut _>` in the current scope
       --> benches/bench.rs:277:30
        |
    277 |             for i in 0..mesh.as_ref().triangles.len() {
        |                              ^^^^^^ method not found in `Pin<&mut _>`
        |
        = note: the method was found for
                - `Pin<P>`
        = note: `mesh` is a function, perhaps you wish to call it
    
    error[E0599]: no method named `as_mut` found for struct `Pin<&mut _>` in the current scope
       --> benches/bench.rs:278:41
        |
    278 |                 let mut triangle = mesh.as_mut().triangles_pin().index_pin(i);
        |                                         ^^^^^^ method not found in `Pin<&mut _>`
        |
        = note: the method was found for
                - `Pin<P>`
        = note: `mesh` is a function, perhaps you wish to call it
    
    error[E0609]: no field `players` on type `&_`
       --> benches/bench.rs:333:28
        |
    333 |         for player in data.players.iter() {
        |                            ^^^^^^^
    
    error[E0609]: no field `players` on type `&_`
       --> benches/bench.rs:399:32
        |
    399 |             for player in data.players.iter() {
        |                                ^^^^^^^
    
    error[E0599]: no method named `as_ref` found for struct `Pin<&mut _>` in the current scope
       --> benches/bench.rs:406:33
        |
    406 |             for i in 0..players.as_ref().players.len() {
        |                                 ^^^^^^ method not found in `Pin<&mut _>`
        |
        = note: the method was found for
                - `Pin<P>`
        = note: `players` is a function, perhaps you wish to call it
    
    error[E0599]: no method named `as_mut` found for struct `Pin<&mut _>` in the current scope
       --> benches/bench.rs:407:42
        |
    407 |                 let mut player = players.as_mut().players_pin().index_pin(i);
        |                                          ^^^^^^ method not found in `Pin<&mut _>`
        |
        = note: the method was found for
                - `Pin<P>`
        = note: `players` is a function, perhaps you wish to call it
    
    Some errors have detailed explanations: E0412, E0432, E0433, E0599, E0609.
    For more information about an error, try `rustc --explain E0412`.
    error: could not compile `rust_serialization_benchmark` due to 29 previous errors
    warning: build failed, waiting for other jobs to finish...
    warning: `rust_serialization_benchmark` (lib test) generated 81 warnings (81 duplicates)
    error: build failed
    

    any idea why?

    bug 
    opened by pvdrz 10
  • Add support for BARE (serde_bare)

    Add support for BARE (serde_bare)

    Thanks for this benchmark!

    I like BARE's dense encoding quite a bit, so thought it'd be interesting to see how it stacks up against the competition. I've only run the benchmark for a few of the libraries that I've been considering (partially because some of the other benchmarks don't compile, or need external tools which weren't easy to figure out how to install).

    EDIT: Here are the results for the formats I was particularly interested in. BARE seems to have an advantage when it comes to size, which is interesting to know :).

    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

    | Format / Lib | Serialize | Deserialize | Size | Zlib | Zstd | |---|--:|--:|--:|--:|--:| | bare | 614.03 us | 2.9164 ms | 765778 | 312739 | 264630 | | bincode | 474.82 us | 2.2372 ms | 1045784 | 374305 | 311761 | | cbor | 1.6595 ms | 5.9777 ms | 1407835 | 407372 | 324081 | | rkyv | 183.76 us | 1.3184 ms* 1.9008 ms* | 1011488 | 392809 | 331932 |

    Zero-copy deserialization speed

    | Format / Lib | Access | Read | Update | |---|--:|--:|--:| | rkyv | 1.0035 ns* 591.06 us* | 9.5201 us* 600.61 us* | 44.896 us |

    Comparison

    Relative to best. Higher is better.

    Serialize / deserialize speed and size

    | Format / Lib | Serialize | Deserialize | Size | Zlib | Zstd | |---|--:|--:|--:|--:|--:| | bare | 29.93% | 45.21% | 100.00% | 100.00% | 100.00% | | bincode | 38.70% | 58.93% | 73.23% | 83.55% | 84.88% | | cbor | 11.07% | 22.06% | 54.39% | 76.77% | 81.66% | | rkyv | 100.00% | 100.00%* 69.36%* | 75.71% | 79.62% | 79.72% |

    Zero-copy deserialization speed

    | Format / Lib | Access | Read | Update | |---|--:|--:|--:| | rkyv | 100.00%* 0.00%* | 100.00%* 1.59%* | 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

    | Format / Lib | Serialize | Deserialize | Size | Zlib | Zstd | |---|--:|--:|--:|--:|--:| | bare | 4.1581 ms | 7.6070 ms | 6000003 | 5380817 | 5345900 | | bincode | 4.9309 ms | 3.3888 ms | 6000008 | 5380823 | 5345890 | | cbor | 36.111 ms | 59.945 ms | 13122324 | 7527423 | 6759658 | | rkyv | 474.21 us | 329.20 us* 318.65 us* | 6000008 | 5380822 | 5345892 |

    Zero-copy deserialization speed

    | Format / Lib | Access | Read | Update | |---|--:|--:|--:| | rkyv | 1.0050 ns* 12.374 ns* | 35.804 us* 34.760 us* | 192.25 us |

    Comparison

    Relative to best. Higher is better.

    Serialize / deserialize speed and size

    | Format / Lib | Serialize | Deserialize | Size | Zlib | Zstd | |---|--:|--:|--:|--:|--:| | bare | 11.40% | 4.19% | 100.00% | 100.00% | 100.00% | | bincode | 9.62% | 9.40% | 100.00% | 100.00% | 100.00% | | cbor | 1.31% | 0.53% | 45.72% | 71.48% | 79.09% | | rkyv | 100.00% | 96.80%* 100.00%* | 100.00% | 100.00% | 100.00% |

    Zero-copy deserialization speed

    | Format / Lib | Access | Read | Update | |---|--:|--:|--:| | rkyv | 100.00%* 8.12%* | 97.08%* 100.00%* | 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

    | Format / Lib | Serialize | Deserialize | Size | Zlib | Zstd | |---|--:|--:|--:|--:|--:| | bare | 659.83 us | 2.7228 ms | 356311 | 213270 | 198488 | | bincode | 473.08 us | 1.9039 ms | 569975 | 240897 | 232423 | | cbor | 1.6809 ms | 5.5620 ms | 1109821 | 347812 | 274526 | | rkyv | 303.12 us | 1.1217 ms* 1.6373 ms* | 596952 | 254571 | 219976 |

    Zero-copy deserialization speed

    | Format / Lib | Access | Read | Update | |---|--:|--:|--:| | rkyv | 495.72 us* | 255.19 ns* 494.63 us* | 2.7913 us |

    Comparison

    Relative to best. Higher is better.

    Serialize / deserialize speed and size

    | Format / Lib | Serialize | Deserialize | Size | Zlib | Zstd | |---|--:|--:|--:|--:|--:| | bare | 45.94% | 41.20% | 100.00% | 100.00% | 100.00% | | bincode | 64.07% | 58.92% | 62.51% | 88.53% | 85.40% | | cbor | 18.03% | 20.17% | 32.11% | 61.32% | 72.30% | | rkyv | 100.00% | 100.00%* 68.51%* | 59.69% | 83.78% | 90.23% |

    Zero-copy deserialization speed

    | Format / Lib | Access | Read | Update | |---|--:|--:|--:| | rkyv | 100.00%* | 100.00%* 0.05%* | 100.00% |

    opened by reivilibre 4
  • Compilation failure on MX-LINUX.

    Compilation failure on MX-LINUX.

    Cloned the repo and ran:

    $ cargo bench
    

    Machine: AMD64 / Mx-linux.

    Had a compilation error due to build.rs script.

      --- stderr                                                                          
      thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Failed, description: "Error while trying to execute `capnp compile`: Failed: Permission denied (os erro
    r 13).  Please verify that version 0.5.2 or higher of the capnp executable is installed on your system. See https://capnproto.org/install.html" }', build.rs:9:10                             
      stack backtrace:    
    ...
    ...
    17:     0x563db33e0c69 - build_script_build::main::h48173f533a2f1a5e
                                     at /home/prataprc/tmp/rust_serialization_benchmark/build.rs:3:5 
    ...
    ...
    

    Can't decipher the reasoning behind the tools/ directory. Looks like they contain windows executable. Let me know whether I am missing something here. Thanks,

    bug good first issue 
    opened by prataprc 4
  • Add validated/unvalidated benchmarks

    Add validated/unvalidated benchmarks

    This is where we start to get into somewhat murky waters. FlatBuffers supports buffer validation, but the dependency needs to get upgraded to 0.8. Cap'n Proto supports validation, but it's lazy so we would need some way of distinguishing that. Maybe splitting the access/read benchmarks into validated/unvalidated for FlatBuffers and rkyv and leaving the Cap'n Proto results as validated.

    opened by djkoloski 3
  • Join rosetta-rs?

    Join rosetta-rs?

    I've been maintaining several benchmark repos based off of template-benchmarks-rs. I've noticed there are several other benchmark repos that are hard to know about.

    I've created rosetta-rs org as a place for these repos if the authors so choose to

    • Increase discoverability
    • Improve bus factor

    See the meta repo for more details

    Interested in collaborating?

    opened by epage 1
  • Add support for simd-json

    Add support for simd-json

    serde_json is good but simd-json is probably more representative of what end users will actually be comparing against. It's also just a good benchmark to have since it's so popular.

    opened by djkoloski 1
  • Benchmark `abomonation` deserialization using `.clone()`

    Benchmark `abomonation` deserialization using `.clone()`

    This is the intended way to deserialize abomonation structures, so adding a bench that performs the clone but notes that it's just a clone and not anything more complicated would be a good way to add more context to the benchmark.

    opened by djkoloski 1
  • Add zlib-compressed size statistic

    Add zlib-compressed size statistic

    In many cases, data is zlib-compressed anyway. Adding a statistic on zlib compression may increase or decrease the relative performance of serialization frameworks.

    enhancement 
    opened by djkoloski 1
  • Shrink unsafe block

    Shrink unsafe block

    In this function you use the unsafe keyword for some safe expressions.

    We need to mark unsafe operations more precisely using unsafe keyword. Keeping unsafe blocks small can bring many benefits. For example, when mistakes happen, we can locate any errors related to memory safety within an unsafe block. This is the balance between Safe and Unsafe Rust. The separation is designed to make using Safe Rust as ergonomic as possible, but requires extra effort and care when writing Unsafe Rust.

    Hope this PR can help you. Best regards. References https://doc.rust-lang.org/nomicon/safe-unsafe-meaning.html https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html

    opened by cactter 0
  • Bincode deserialization could be faster

    Bincode deserialization could be faster

    I noticed that the structs you're using with serde-based deserializers actually have an owned String in them. However, bincode doesn't need to copy strings (I'm not aware about the others).

    I'm actually using this in zoxide right now. Here's my struct definitions:

    #[derive(Debug, Deserialize, Serialize)]
    pub struct DirList<'a>(#[serde(borrow)] Vec<Dir<'a>>);
    
    #[derive(Clone, Debug, Deserialize, Serialize)]
    pub struct Dir<'a> {
        #[serde(borrow)]
        pub path: Cow<'a, str>,
        pub rank: Rank,
        pub last_accessed: Epoch,
    }
    

    Since the necessary bytes are already in the Vec<u8> that you're trying to deserialize, bincode will just give you a pointer to it instead of copying a whole new String into memory, which is much faster. You can verify this by checking that the deserialized struct actually contains a Cow::Borrowed. You might be able to use a regular &str too, although I'm not sure how bincode would handle different endianness in that case.

    P.S. thanks for your fantastic work on rkyv and these benchmarks! Not only is rkyv's performance amazing, it's ideas like structver that would make this a serious contender for anyone wanting a serialization library. I'm currently using a poor man's structver myself, so the idea of rkyv handling this for me sounds absolutely great.

    enhancement 
    opened by ajeetdsouza 2
  • Benchmark including I/O

    Benchmark including I/O

    Adding a benchmark including I/O time would be useful. Usually serialization/deserialization involves network or disk I/O, and the medium affects the overall performance.

    For example, it is unclear from the table in README.md whether rkyv/speedy are faster than prost in real scenarios because the disk read is faster with protobuf. Probably rkyv/speedy are faster than protobuf in LAN. Are they faster in SSD? We do not know.

    These additions will help readers make a quick choice on the library.

    • HDD with low IOPS or RPM + Serialization/Deseiralization
    • HDD with high IOPS or RPM + Serialization/Deseiralization
    • SSD + Serialization/Deseiralization
    • Network 10/100/1000 Mbps + Serialization/Deseiralization
    enhancement 
    opened by elbaro 3
  • Flatbuffers serialization could be faster

    Flatbuffers serialization could be faster

    It looks like we could be carrying around scratch space and reusing it based on this issue: https://github.com/google/flatbuffers/issues/6511

    I think that's a little much to ask considering how much serialization code is already written for this benchmark, but it's worth keeping in mind.

    opened by djkoloski 0
  • Enable PGO for benchmarks

    Enable PGO for benchmarks

    Enabling profile-guided optimization will provide some numbers that are the best they can be for each framework. It might be worth separating these out from the general numbers so users can get an idea of how much they stand to gain for their efforts.

    opened by djkoloski 1
  • Add memory and code size benchmarks

    Add memory and code size benchmarks

    It would be useful to see benchmarks on memory usage and code size.

    dhat is a Rust crate that provides profiling of heap allocations. One could also use Valgrind. Heap is the most important, but it would also be useful to see stats on stack and static memory.

    For code size, I like to follow the instructions on min-sized-rust to remove a lot of the noise in the binary.

    I may be able to help with this.

    opened by sffc 0
Releases(2021-3-18)
  • 2021-3-18(Mar 18, 2021)

  • 2021-3-13(Mar 14, 2021)

    This benchmark update adds a few new libraries:

    A number of benchmark results have also been updated with variants and extra details:

    • prost had its serialization results split into "populate + encode" (for non-viral serialization types) and "encode" (for viral serialization types)
    • All zero-copy deserialization libraries have had validation details added to their access and read times

    Additionally, the additional zero-copy framework tests are now separated out into a separate table since horizontal space was running low.

    Source code(tar.gz)
    Source code(zip)
Owner
David Koloski
Software engineer and game developer. Making state of the art rust libraries to help destroy C++.
David Koloski
Handle some lichess.org/tournament load with Rust, while learning Rust

lila-http Take some of the HTTP load away from lila. WIP! Arena tournaments Clients connected to a tournament page request new data about the tourname

Lichess 22 Jan 2, 2023
HTTP mocking library for Rust.

httpmock HTTP mocking library for Rust. Documentation · Crate · Report Bug · Request Feature · Changelog Features Simple, expressive, fluent API. Many

Alexander Liesenfeld 320 Dec 21, 2022
Testing Framework for Rust

Polish Polish is Test-Driven Development done right Getting Started Installing the Package The crates.io package is kept up-to-date with all the major

Fadi Hanna Al-Kass 49 Dec 18, 2022
🐇 Fuzzing Rust code with American Fuzzy Lop

afl.rs Fuzzing Rust code with AFLplusplus What is it? Fuzz testing is a software testing technique used to find security and stability issues by provi

Rust Fuzzing Authority 1.3k Jan 5, 2023
Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows

trust Travis CI and AppVeyor template to test your Rust crate on 5 architectures and publish binary releases of it for Linux, macOS and Windows Featur

Jorge Aparicio 1.2k Dec 30, 2022
A library for generating fake data in Rust.

Fake A Rust library for generating fake data. Installation Default (rand is required): [dependencies] fake = "2.4" rand = "0.8" If you want to use #[d

cksac 552 Dec 25, 2022
Playwright is a rust library to automate Chromium, Firefox and WebKit built on top of Node.js library.

?? Playwright for Rust Playwright is a rust library to automate Chromium, Firefox and WebKit built on top of Node.js library. Installation [dependenci

octaltree 132 Jan 6, 2023
ArchTest is a rule based architecture testing tool for rust

ArchTest is a rule based architecture testing tool. It applies static analyses on the specified rust project to extract use relationships.

Tom Dymel 7 Sep 26, 2021
Advanced Fuzzing Library - Slot your Fuzzer together in Rust! Scales across cores and machines. For Windows, Android, MacOS, Linux, no_std, ...

LibAFL, the fuzzer library. Advanced Fuzzing Library - Slot your own fuzzers together and extend their features using Rust. LibAFL is written and main

Advanced Fuzzing League ++ 1.2k Dec 29, 2022
Structure-aware, in-process, coverage-guided, evolutionary fuzzing engine for Rust functions.

fuzzcheck Fuzzcheck is a structure-aware, in-process, coverage-guided, evolutionary fuzzing engine for Rust functions. Given a function test: (T) -> b

Loïc Lecrenier 394 Dec 20, 2022
A fuzzer framework built in Rust

lain This crate provides functionality one may find useful while developing a fuzzer. A recent nightly Rust build is required for the specialization f

Microsoft 469 Dec 9, 2022
A fast Rust-based safe and thead-friendly grammar-based fuzz generator

Intro fzero is a grammar-based fuzzer that generates a Rust application inspired by the paper "Building Fast Fuzzers" by Rahul Gopinath and Andreas Ze

null 203 Nov 9, 2022
How-to: Sanitize your Rust code!

rust-san How-to: Sanitize your Rust code! Intro How to use the sanitizers? Examples AddressSanitizer Out of bounds access Use after free LeakSanitizer

Jorge Aparicio 359 Dec 22, 2022
Automated property based testing for Rust (with shrinking).

quickcheck QuickCheck is a way to do property based testing using randomly generated input. This crate comes with the ability to randomly generate and

Andrew Gallant 2k Jan 2, 2023
Hypothesis-like property testing for Rust

Proptest Introduction Proptest is a property testing framework (i.e., the QuickCheck family) inspired by the Hypothesis framework for Python. It allow

Jason Lingle 1.1k Jan 1, 2023
QuickCheck bug hunting in Rust standard library data structures

BugHunt, Rust This project is aiming to provide "stateful" QuickCheck models for Rust's standard library. That is, we build up a random list of operat

Brian L. Troutwine 161 Dec 15, 2022
Breaking your Rust code for fun and profit

Breaking your Rust code for fun & profit this is an architecture-preview, not all components are there This is a mutation testing framework for Rust c

null 533 Dec 18, 2022
Simple goldenfile testing in Rust.

?? Rust Goldenfile Simple goldenfile testing in Rust. Goldenfile tests generate one or more output files as they run. At the end of the test, the gene

Calder Coalson 24 Nov 26, 2022
Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.

An implementation of the Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.

Brendan Molloy 394 Jan 1, 2023