Multiple Fields
This benchmarks compares the performance of the different algorithms when serializing and deserializing a message with multiple fields. In particula for schema-less messages, this will show how well different message formats store the schema in the message. Fields have different basic types (string, u32, u64, i32, i64, f32, f64, bool, u8, i8, u16, i16).
#![allow(unused)] fn main() { pub struct MultipleFields { field_of_type_string: String, field_of_type_u32: u32, field_of_type_u64: u64, field_of_type_i32: i32, field_of_type_i64: i64, field_of_type_f32: f32, field_of_type_f64: f64, field_of_type_bool: bool, field_of_type_u8: u8, field_of_type_i8: i8, field_of_type_u16: u16, field_of_type_i16: i16, second_field_of_type_string: String, second_field_of_type_u32: u32, second_field_of_type_u64: u64, second_field_of_type_i32: i32, second_field_of_type_i64: i64, third_field_of_type_string: String, third_field_of_type_u32: u32, third_field_of_type_u64: u64, third_field_of_type_i32: i32, third_field_of_type_i64: i64, fourth_field_of_type_string: String, fourth_field_of_type_u32: u32, fourth_field_of_type_u64: u64, fourth_field_of_type_i32: i32, fourth_field_of_type_i64: i64, } }
Test specs
- Iterations:
k = 10
- Serialization and deserialization repetitions / iteration:
n = 100000
- Data size:
210
bytes - Protobuf: Not supported (due to the fields of type
i8
andi16
that are not supported by protobuf)
Results
1. Windows Execution
Algorithm | Size (b) | Ser. (ms) | Deser. (ms) | Ser+Deser.(ms) |
---|---|---|---|---|
FlatMessage (⚠️) | 355 [ +69%] | 2.63 [ 2.20 - 2.92] | 20.33 [ 17.33 - 22.89] | 23.54 [ 20.05 - 26.37] |
FlatMessage | 355 [ +69%] | 2.77 [ 2.27 - 3.43] | 23.87 [ 22.55 - 26.51] | 27.36 [ 25.19 - 30.78] |
bincode (schema) | 172 [ -19%] | 10.03 [ 8.53 - 10.70] | 29.41 [ 25.72 - 31.81] | 39.87 [ 35.29 - 44.48] |
postcard (schema) | 154 [ -27%] | 10.47 [ 9.49 - 11.46] | 30.39 [ 27.74 - 32.77] | 42.47 [ 38.92 - 45.02] |
rmp (schema) | 179 [ -15%] | 13.60 [ 12.54 - 14.61] | 38.97 [ 34.48 - 42.74] | 59.93 [ 54.80 - 68.55] |
rmp | 776 [+269%] | 21.74 [ 18.31 - 22.99] | 90.83 [ 78.58 - 99.07] | 126.98 [112.18 - 138.83] |
cbor | 786 [+274%] | 47.90 [ 42.23 - 55.22] | 169.09 [148.57 - 182.64] | 222.42 [192.96 - 240.77] |
json | 895 [+326%] | 68.24 [ 58.92 - 74.31] | 140.85 [122.75 - 151.39] | 225.94 [198.50 - 246.99] |
bson | 885 [+321%] | 57.16 [ 51.87 - 62.13] | 164.07 [144.80 - 178.24] | 233.80 [204.84 - 259.61] |
simd_json | 895 [+326%] | 88.45 [ 76.05 - 99.23] | 168.27 [151.13 - 181.42] | 270.51 [248.37 - 295.02] |
flexbuffers | 1022 [+386%] | 439.06 [381.02 - 476.33] | 181.15 [165.53 - 196.50] | 646.95 [576.51 - 696.58] |
toml | 894 [+325%] | 369.89 [335.68 - 402.81] | 856.84 [754.40 - 938.28] | 1254.35 [1127.43 - 1386.98] |
protobuf | - | - | - | - |
2. MacOs Execution
Algorithm | Size (b) | Ser. (ms) | Deser. (ms) | Ser+Deser.(ms) |
---|---|---|---|---|
FlatMessage (⚠️) | 355 [ +69%] | 3.04 [ 3.04 - 4.01] | 10.44 [ 10.37 - 12.33] | 13.46 [ 13.45 - 14.61] |
FlatMessage | 355 [ +69%] | 3.15 [ 3.05 - 7.92] | 13.27 [ 13.18 - 17.01] | 16.81 [ 16.75 - 20.53] |
bincode (schema) | 172 [ -19%] | 7.65 [ 7.64 - 7.88] | 15.46 [ 15.35 - 15.85] | 23.49 [ 23.40 - 24.18] |
postcard (schema) | 154 [ -27%] | 9.53 [ 9.52 - 9.60] | 17.01 [ 16.93 - 17.19] | 26.71 [ 26.66 - 26.80] |
rmp (schema) | 179 [ -15%] | 12.10 [ 12.10 - 12.32] | 24.89 [ 24.84 - 24.98] | 37.36 [ 37.26 - 37.59] |
rmp | 776 [+269%] | 21.10 [ 21.10 - 21.50] | 58.73 [ 58.55 - 60.41] | 80.55 [ 80.29 - 82.82] |
json | 895 [+326%] | 59.76 [ 59.59 - 61.49] | 81.90 [ 81.72 - 84.49] | 142.89 [142.56 - 147.54] |
bson | 885 [+321%] | 51.69 [ 51.63 - 52.08] | 116.45 [116.16 - 117.56] | 169.88 [169.48 - 172.46] |
simd_json | 895 [+326%] | 63.60 [ 63.40 - 65.63] | 107.18 [106.12 - 110.47] | 173.02 [171.21 - 177.92] |
cbor | 786 [+274%] | 42.49 [ 42.45 - 43.61] | 132.44 [132.25 - 132.82] | 176.32 [175.69 - 176.87] |
flexbuffers | 1022 [+386%] | 349.96 [348.16 - 359.48] | 112.39 [111.88 - 119.31] | 467.53 [466.12 - 480.27] |
toml | 894 [+325%] | 288.15 [283.89 - 295.04] | 554.20 [552.77 - 557.26] | 857.29 [855.34 - 864.52] |
protobuf | - | - | - | - |
3. Linux Execution
Algorithm | Size (b) | Ser. (ms) | Deser. (ms) | Ser+Deser.(ms) |
---|---|---|---|---|
FlatMessage (⚠️) | 355 [ +69%] | 2.73 [ 2.66 - 3.49] | 7.52 [ 7.34 - 11.19] | 10.22 [ 9.79 - 15.88] |
FlatMessage | 355 [ +69%] | 2.67 [ 2.34 - 3.86] | 12.70 [ 11.92 - 19.66] | 14.87 [ 14.51 - 21.55] |
postcard (schema) | 154 [ -27%] | 10.31 [ 9.99 - 12.47] | 16.15 [ 15.66 - 19.02] | 27.22 [ 26.14 - 32.00] |
bincode (schema) | 172 [ -19%] | 10.29 [ 9.74 - 10.96] | 17.78 [ 16.95 - 35.14] | 28.60 [ 27.73 - 39.15] |
rmp (schema) | 179 [ -15%] | 14.03 [ 13.40 - 23.77] | 27.17 [ 26.72 - 36.25] | 46.48 [ 44.50 - 50.72] |
rmp | 776 [+269%] | 21.56 [ 20.76 - 23.37] | 69.45 [ 68.10 - 75.75] | 95.85 [ 93.59 - 98.88] |
json | 895 [+326%] | 64.40 [ 62.01 - 69.40] | 113.40 [109.06 - 127.41] | 197.48 [184.91 - 247.76] |
simd_json | 895 [+326%] | 67.63 [ 62.81 - 74.22] | 125.92 [117.82 - 146.19] | 205.14 [193.67 - 269.61] |
cbor | 786 [+274%] | 46.78 [ 45.37 - 48.92] | 151.96 [147.25 - 155.70] | 207.72 [199.29 - 233.28] |
bson | 885 [+321%] | 54.75 [ 51.70 - 78.50] | 144.14 [139.10 - 160.18] | 208.93 [197.22 - 229.21] |
flexbuffers | 1022 [+386%] | 395.54 [376.59 - 449.20] | 153.44 [150.59 - 165.30] | 579.35 [544.29 - 630.75] |
toml | 894 [+325%] | 315.82 [297.91 - 379.37] | 761.90 [735.18 - 812.90] | 1101.13 [1050.93 - 1204.26] |
protobuf | - | - | - | - |