Large Vectors
This benchmarks checks to see how well a structure containing fields of type Option<T>
can be serialized and deserialized.
The structure is initialized as follows:
opt_one
is initialized toSome("Hello, World - this is an option field")
opt_two
is initialized toSome(12345678)
opt_three
is initialized toNone
opt_four
is initialized toSome([1, 2, 3, 4, 100, 200, 300, 400, 1000, 2000, 3000, 4000, 10000, 20000, 30000, 40000])
opt_five
is initialized toSome(["Hello", "World", "This", "is", "an", "option", "field"])
opt_six
is initialized toNone
opt_seven
is initialized toNone
#![allow(unused)] fn main() { pub struct OptionFields { opt_one: Option<String>, opt_two: Option<u32>, opt_three: Option<bool>, opt_four: Option<Vec<u32>>, opt_five: Option<Vec<String>>, opt_six: Option<String>, opt_seven: Option<Vec<u32>>, } }
Test specs
- Iterations:
k = 10
- Serialization and deserialization repetitions / iteration:
n = 100000
- Data size:
145
bytes - Protobuf: Not Supported (Option
is not supported in protobuf via prost crate)
Results
1. Windows Execution
Algorithm | Size (b) | Ser. (ms) | Deser. (ms) | Ser+Deser.(ms) |
---|---|---|---|---|
FlatMessage (⚠️) | 191 [ +31%] | 4.26 [ 3.78 - 4.86] | 37.45 [ 34.92 - 44.13] | 43.90 [ 40.06 - 50.40] |
FlatMessage | 191 [ +31%] | 4.52 [ 3.81 - 5.04] | 45.98 [ 44.20 - 53.71] | 50.69 [ 47.01 - 56.24] |
postcard (schema) | 118 [ -19%] | 12.51 [ 11.52 - 14.10] | 48.39 [ 44.57 - 53.89] | 64.46 [ 58.04 - 69.73] |
bincode (schema) | 125 [ -14%] | 11.43 [ 10.40 - 13.85] | 54.60 [ 50.89 - 63.12] | 70.15 [ 63.19 - 79.04] |
rmp (schema) | 126 [ -14%] | 9.33 [ 8.37 - 10.89] | 62.90 [ 57.03 - 72.54] | 74.37 [ 68.82 - 86.99] |
rmp | 188 [ +29%] | 10.82 [ 9.89 - 12.04] | 72.12 [ 68.27 - 82.56] | 86.56 [ 82.02 - 98.82] |
json | 264 [ +82%] | 23.04 [ 21.89 - 26.13] | 118.43 [110.81 - 135.33] | 149.71 [142.48 - 169.75] |
simd_json | 264 [ +82%] | 26.31 [ 25.21 - 29.14] | 153.30 [149.29 - 205.95] | 188.02 [173.91 - 241.76] |
cbor | 187 [ +28%] | 26.08 [ 24.49 - 30.69] | 161.60 [150.53 - 198.38] | 190.97 [183.57 - 335.13] |
bson | 402 [+177%] | 67.99 [ 63.65 - 86.69] | 152.11 [143.13 - 185.71] | 232.28 [217.78 - 269.26] |
flexbuffers | 254 [ +75%] | 151.98 [145.21 - 176.35] | 116.80 [109.76 - 128.22] | 282.20 [264.99 - 322.41] |
toml | 235 [ +62%] | 157.57 [143.44 - 171.29] | 431.05 [401.97 - 472.36] | 601.73 [564.37 - 655.63] |
protobuf | - | - | - | - |
2. MacOs Execution
Algorithm | Size (b) | Ser. (ms) | Deser. (ms) | Ser+Deser.(ms) |
---|---|---|---|---|
FlatMessage (⚠️) | 191 [ +31%] | 4.63 [ 4.53 - 4.68] | 20.67 [ 20.26 - 23.96] | 25.26 [ 25.00 - 25.82] |
FlatMessage | 191 [ +31%] | 4.79 [ 4.54 - 18.56] | 25.49 [ 24.83 - 28.69] | 30.17 [ 29.54 - 31.25] |
bincode (schema) | 125 [ -14%] | 10.37 [ 10.19 - 30.40] | 29.61 [ 29.11 - 30.90] | 40.65 [ 40.08 - 41.13] |
postcard (schema) | 118 [ -19%] | 12.40 [ 12.31 - 12.49] | 28.07 [ 27.69 - 28.48] | 40.99 [ 40.18 - 41.32] |
rmp (schema) | 126 [ -14%] | 10.60 [ 10.39 - 10.74] | 37.17 [ 36.80 - 37.78] | 47.63 [ 47.19 - 48.06] |
rmp | 188 [ +29%] | 11.88 [ 11.72 - 12.11] | 44.46 [ 44.05 - 45.68] | 56.63 [ 56.12 - 56.98] |
json | 264 [ +82%] | 23.77 [ 23.49 - 23.87] | 68.47 [ 67.91 - 68.60] | 92.42 [ 92.15 - 92.85] |
simd_json | 264 [ +82%] | 27.25 [ 26.82 - 27.53] | 104.36 [103.07 - 107.31] | 131.90 [131.54 - 192.58] |
cbor | 187 [ +28%] | 24.08 [ 23.75 - 24.39] | 121.37 [120.49 - 122.90] | 146.94 [145.62 - 147.81] |
bson | 402 [+177%] | 52.94 [ 52.37 - 53.36] | 101.40 [100.55 - 120.19] | 159.05 [158.11 - 160.64] |
flexbuffers | 254 [ +75%] | 107.38 [106.93 - 108.01] | 73.84 [ 73.58 - 74.24] | 186.75 [186.05 - 187.50] |
toml | 235 [ +62%] | 117.48 [116.20 - 118.65] | 282.25 [280.15 - 286.42] | 408.69 [406.48 - 432.76] |
protobuf | - | - | - | - |
3. Linux Execution
Algorithm | Size (b) | Ser. (ms) | Deser. (ms) | Ser+Deser.(ms) |
---|---|---|---|---|
FlatMessage (⚠️) | 191 [ +31%] | 3.42 [ 3.10 - 3.69] | 12.64 [ 12.20 - 14.05] | 16.34 [ 15.39 - 18.91] |
FlatMessage | 191 [ +31%] | 3.14 [ 2.98 - 3.51] | 18.85 [ 17.88 - 21.14] | 23.02 [ 22.31 - 24.93] |
postcard (schema) | 118 [ -19%] | 11.79 [ 11.12 - 12.19] | 22.31 [ 21.80 - 23.84] | 34.81 [ 34.09 - 37.21] |
bincode (schema) | 125 [ -14%] | 10.25 [ 10.10 - 11.30] | 28.59 [ 27.92 - 31.71] | 42.14 [ 41.50 - 46.19] |
rmp (schema) | 126 [ -14%] | 8.23 [ 8.04 - 9.26] | 34.27 [ 33.12 - 37.70] | 44.33 [ 43.24 - 49.31] |
rmp | 188 [ +29%] | 9.28 [ 9.05 - 10.38] | 42.29 [ 41.09 - 47.13] | 55.92 [ 54.69 - 62.79] |
json | 264 [ +82%] | 22.23 [ 21.78 - 26.22] | 73.41 [ 71.95 - 81.41] | 105.77 [ 97.07 - 133.97] |
simd_json | 264 [ +82%] | 26.10 [ 24.60 - 37.97] | 94.13 [ 88.75 - 99.57] | 124.87 [119.99 - 134.12] |
cbor | 187 [ +28%] | 25.62 [ 24.91 - 27.00] | 127.50 [124.79 - 133.87] | 154.28 [152.52 - 165.43] |
bson | 402 [+177%] | 63.22 [ 62.09 - 66.58] | 113.48 [111.71 - 120.82] | 186.09 [183.00 - 244.09] |
flexbuffers | 254 [ +75%] | 118.33 [113.95 - 136.28] | 83.15 [ 82.46 - 92.44] | 230.28 [209.08 - 262.75] |
toml | 235 [ +62%] | 131.17 [126.57 - 164.83] | 353.57 [344.60 - 394.50] | 527.41 [500.84 - 586.29] |
protobuf | - | - | - | - |