Nested Structures

This benchmarks compares the performance of the different algorithms to serialize and deserialize a nested structure.

#![allow(unused)]
fn main() {
pub struct LevelOne {
    s1: String,
    s2: String,
    v1: u32,
    v2: u64,
    arr: Vec<u32>,
}

pub struct DepthTwo {
    name: String,
    arr: Vec<String>,
    level_1: Option<LevelOne>,    
}

pub struct NestedStrucs {
    name: String,
    protected_process: bool,
    protected_process: bool,
    level_1: Option<LevelOne>,
    level_2: Option<DepthTwo>,
}

}

Test specs

  • Iterations: k = 10
  • Serialization and deserialization repetitions / iteration: n = 100000
  • Data size: 413 bytes
  • Protobuf: Supported

Results

1. Windows Execution

AlgorithmSize (b)Ser. (ms)Deser. (ms)Ser+Deser.(ms)
FlatMessage (⚠️)492
[ +19%]
5.20
[ 4.88 - 5.45]
72.86
[ 70.06 - 75.31]
79.79
[ 76.33 - 82.42]
FlatMessage492
[ +19%]
5.44
[ 5.12 - 6.01]
77.29
[ 74.28 - 78.73]
83.24
[ 79.34 - 84.23]
postcard (schema)363
[ -13%]
12.65
[ 11.78 - 13.56]
78.92
[ 74.58 - 87.94]
92.35
[ 87.00 - 97.69]
bincode (schema)367
[ -12%]
10.33
[ 9.64 - 10.96]
81.51
[ 76.76 - 83.54]
92.47
[ 88.25 - 95.42]
rmp (schema)374
[ -10%]
10.91
[ 10.37 - 11.46]
93.90
[ 89.82 - 97.09]
114.19
[106.86 - 119.30]
protobuf (schema)382
[ -8%]
16.35
[ 15.90 - 18.39]
115.21
[109.60 - 118.23]
136.54
[130.97 - 150.26]
rmp462
[ +11%]
13.39
[ 12.67 - 13.72]
114.01
[108.96 - 117.29]
136.85
[129.60 - 140.75]
json550
[ +33%]
42.16
[ 40.85 - 44.91]
183.08
[175.98 - 201.92]
232.73
[225.25 - 252.79]
cbor463
[ +12%]
34.32
[ 32.90 - 35.54]
214.70
[204.56 - 223.01]
254.37
[246.49 - 262.38]
simd_json550
[ +33%]
37.78
[ 36.30 - 68.77]
208.22
[197.99 - 212.99]
260.11
[248.91 - 262.04]
bson701
[ +69%]
67.60
[ 64.28 - 70.99]
207.89
[195.47 - 214.32]
293.14
[284.69 - 301.15]
flexbuffers561
[ +35%]
236.30
[220.19 - 248.87]
188.59
[182.44 - 194.91]
442.59
[421.71 - 458.80]
toml568
[ +37%]
443.99
[428.89 - 507.61]
790.28
[761.49 - 813.41]
1284.78
[1249.50 - 1332.13]

2. MacOs Execution

AlgorithmSize (b)Ser. (ms)Deser. (ms)Ser+Deser.(ms)
FlatMessage (⚠️)492
[ +19%]
7.10
[ 7.08 - 7.15]
32.95
[ 32.82 - 33.11]
40.11
[ 40.08 - 40.21]
FlatMessage492
[ +19%]
7.09
[ 7.08 - 10.23]
35.39
[ 35.05 - 36.22]
42.32
[ 42.20 - 63.22]
bincode (schema)367
[ -12%]
10.52
[ 10.44 - 10.55]
37.41
[ 37.29 - 37.44]
48.70
[ 48.40 - 48.84]
postcard (schema)363
[ -13%]
13.09
[ 13.08 - 13.14]
37.52
[ 37.45 - 38.56]
50.81
[ 50.73 - 69.73]
rmp (schema)374
[ -10%]
12.17
[ 12.11 - 12.24]
52.43
[ 52.11 - 53.21]
64.47
[ 64.03 - 64.99]
protobuf (schema)382
[ -8%]
14.73
[ 14.41 - 14.87]
59.14
[ 58.93 - 59.25]
76.91
[ 76.42 - 78.01]
rmp462
[ +11%]
15.60
[ 15.59 - 15.67]
68.62
[ 68.49 - 69.66]
83.70
[ 83.54 - 84.23]
json550
[ +33%]
39.29
[ 39.25 - 39.43]
103.64
[101.90 - 111.56]
143.19
[142.49 - 148.35]
simd_json550
[ +33%]
39.63
[ 39.55 - 40.35]
125.81
[125.50 - 127.23]
168.68
[167.92 - 169.57]
cbor463
[ +12%]
35.39
[ 35.25 - 35.55]
153.95
[153.43 - 155.27]
192.12
[191.47 - 209.82]
bson701
[ +69%]
58.97
[ 58.87 - 59.11]
170.97
[168.88 - 173.12]
237.09
[235.52 - 238.60]
flexbuffers561
[ +35%]
153.11
[152.18 - 154.83]
112.54
[112.17 - 128.58]
274.44
[273.39 - 275.55]
toml568
[ +37%]
320.21
[316.47 - 322.28]
517.88
[514.60 - 519.24]
857.90
[850.86 - 872.40]

3. Linux Execution

AlgorithmSize (b)Ser. (ms)Deser. (ms)Ser+Deser.(ms)
FlatMessage (⚠️)492
[ +19%]
3.85
[ 3.75 - 4.08]
22.76
[ 22.11 - 24.03]
28.22
[ 27.52 - 29.62]
FlatMessage492
[ +19%]
3.85
[ 3.48 - 4.21]
25.79
[ 23.51 - 27.38]
31.01
[ 30.04 - 32.83]
postcard (schema)363
[ -13%]
10.40
[ 10.19 - 12.28]
28.75
[ 27.75 - 29.47]
39.97
[ 39.09 - 42.63]
bincode (schema)367
[ -12%]
10.76
[ 10.29 - 15.11]
33.60
[ 31.77 - 51.56]
45.97
[ 44.23 - 54.86]
rmp (schema)374
[ -10%]
9.71
[ 9.40 - 10.91]
42.43
[ 41.54 - 45.29]
55.96
[ 54.28 - 64.53]
protobuf (schema)382
[ -8%]
18.35
[ 17.17 - 20.41]
50.49
[ 48.84 - 61.20]
71.55
[ 70.69 - 105.56]
rmp462
[ +11%]
12.37
[ 11.73 - 14.78]
63.32
[ 61.82 - 66.45]
81.55
[ 78.86 - 94.16]
json550
[ +33%]
43.82
[ 42.84 - 46.60]
103.38
[101.26 - 107.43]
154.22
[151.84 - 187.59]
simd_json550
[ +33%]
39.29
[ 37.64 - 49.09]
118.76
[114.23 - 126.63]
170.38
[162.93 - 175.95]
cbor463
[ +12%]
34.88
[ 33.48 - 40.48]
161.63
[157.12 - 179.40]
198.24
[196.08 - 240.00]
bson701
[ +69%]
67.28
[ 65.60 - 75.67]
144.59
[138.76 - 172.56]
230.37
[220.26 - 268.93]
flexbuffers561
[ +35%]
173.97
[166.69 - 196.07]
128.95
[127.13 - 196.57]
319.99
[307.34 - 391.62]
toml568
[ +37%]
313.47
[294.51 - 352.35]
628.34
[613.12 - 669.64]
1006.52
[960.33 - 1051.88]