Point
This benchmarks compares the performance of the different algorithms to serialize and deserialize a point structure. The idea is to see how well the algorithms handle the case of a small structure with 4 bytes alignment.
#![allow(unused)] fn main() { pub struct Point { x: i32, y: i32, } }
Test specs
- Iterations:
k = 10
- Serialization and deserialization repetitions / iteration:
n = 500000
- Data size:
8
bytes - Protobuf: Supported
Results
1. Windows Execution
Algorithm | Size (b) | Ser. (ms) | Deser. (ms) | Ser+Deser.(ms) |
---|---|---|---|---|
FlatMessage (⚠️) | 26 [+225%] | 0.99 [ 0.76 - 1.17] | 3.30 [ 3.12 - 3.75] | 3.76 [ 3.61 - 4.37] |
FlatMessage | 26 [+225%] | 0.91 [ 0.78 - 1.58] | 3.57 [ 3.54 - 6.56] | 4.49 [ 4.05 - 5.88] |
postcard (schema) | 3 [ -63%] | 3.78 [ 3.60 - 3.85] | 2.93 [ 2.77 - 3.10] | 6.95 [ 6.69 - 7.29] |
bincode (schema) | 2 [ -75%] | 2.76 [ 2.65 - 3.07] | 3.15 [ 2.93 - 3.29] | 7.07 [ 6.67 - 7.35] |
rmp (schema) | 3 [ -63%] | 5.74 [ 5.49 - 6.29] | 5.15 [ 4.81 - 5.77] | 11.09 [ 10.60 - 11.95] |
rmp | 7 [ -13%] | 6.93 [ 6.34 - 7.88] | 10.51 [ 9.78 - 10.75] | 16.60 [ 15.79 - 17.80] |
protobuf (schema) | 13 [ +62%] | 11.72 [ 10.77 - 12.29] | 5.88 [ 5.39 - 6.27] | 17.59 [ 16.44 - 18.29] |
json | 17 [+112%] | 11.30 [ 10.51 - 12.34] | 24.70 [ 22.61 - 25.42] | 39.57 [ 36.79 - 41.07] |
bson | 19 [+137%] | 17.92 [ 17.33 - 28.72] | 43.09 [ 42.27 - 60.24] | 60.15 [ 57.02 - 62.73] |
cbor | 8 [ +0%] | 14.51 [ 13.55 - 17.31] | 56.70 [ 55.18 - 64.55] | 68.12 [ 66.53 - 81.23] |
simd_json | 17 [+112%] | 10.86 [ 10.31 - 11.05] | 191.43 [181.89 - 194.51] | 207.16 [193.80 - 208.84] |
flexbuffers | 17 [+112%] | 189.42 [184.32 - 192.16] | 44.84 [ 40.74 - 46.18] | 251.47 [238.92 - 253.57] |
toml | 16 [+100%] | 157.98 [149.10 - 159.28] | 286.86 [270.90 - 290.13] | 476.62 [452.59 - 489.41] |
2. MacOs Execution
Algorithm | Size (b) | Ser. (ms) | Deser. (ms) | Ser+Deser.(ms) |
---|---|---|---|---|
FlatMessage | 26 [+225%] | 1.05 [ 1.05 - 1.12] | 2.46 [ 2.40 - 2.55] | 2.84 [ 2.82 - 3.00] |
FlatMessage (⚠️) | 26 [+225%] | 1.01 [ 1.01 - 1.05] | 2.21 [ 2.17 - 2.27] | 2.84 [ 2.42 - 5.61] |
postcard (schema) | 3 [ -63%] | 3.10 [ 3.10 - 3.19] | 1.16 [ 1.12 - 2.21] | 3.72 [ 3.72 - 3.83] |
bincode (schema) | 2 [ -75%] | 2.06 [ 2.05 - 2.12] | 2.64 [ 2.63 - 4.23] | 4.41 [ 4.39 - 4.45] |
rmp (schema) | 3 [ -63%] | 4.63 [ 4.56 - 7.88] | 4.62 [ 4.35 - 6.83] | 9.05 [ 8.85 - 12.32] |
rmp | 7 [ -13%] | 4.96 [ 4.81 - 6.02] | 10.46 [ 10.38 - 12.31] | 15.25 [ 15.20 - 16.42] |
protobuf (schema) | 13 [ +62%] | 9.43 [ 9.13 - 10.31] | 6.06 [ 6.04 - 6.13] | 15.38 [ 15.24 - 15.48] |
json | 17 [+112%] | 11.64 [ 11.62 - 11.77] | 20.35 [ 20.16 - 20.54] | 31.77 [ 31.63 - 32.02] |
bson | 19 [+137%] | 12.40 [ 12.38 - 12.48] | 24.88 [ 24.84 - 34.03] | 41.56 [ 41.49 - 41.80] |
cbor | 8 [ +0%] | 13.18 [ 13.17 - 13.28] | 62.83 [ 62.76 - 66.50] | 77.80 [ 77.63 - 79.15] |
flexbuffers | 17 [+112%] | 99.77 [ 99.40 - 100.22] | 29.26 [ 29.22 - 49.78] | 139.39 [138.64 - 153.18] |
simd_json | 17 [+112%] | 8.64 [ 8.59 - 8.91] | 129.03 [125.62 - 136.86] | 139.43 [136.12 - 144.18] |
toml | 16 [+100%] | 81.83 [ 81.68 - 84.24] | 220.94 [219.94 - 231.54] | 325.22 [324.07 - 333.64] |
3. Linux Execution
Algorithm | Size (b) | Ser. (ms) | Deser. (ms) | Ser+Deser.(ms) |
---|---|---|---|---|
FlatMessage (⚠️) | 26 [+225%] | 0.82 [ 0.80 - 0.86] | 3.50 [ 3.42 - 3.68] | 3.91 [ 3.85 - 4.14] |
FlatMessage | 26 [+225%] | 0.84 [ 0.82 - 0.90] | 3.95 [ 3.86 - 4.18] | 4.25 [ 4.14 - 4.48] |
postcard (schema) | 3 [ -63%] | 3.84 [ 3.77 - 4.35] | 3.11 [ 3.01 - 3.52] | 6.93 [ 6.77 - 7.80] |
bincode (schema) | 2 [ -75%] | 2.89 [ 2.15 - 3.64] | 3.18 [ 3.07 - 3.48] | 7.76 [ 7.60 - 8.21] |
rmp (schema) | 3 [ -63%] | 6.01 [ 5.96 - 6.39] | 5.21 [ 5.05 - 5.42] | 11.41 [ 11.20 - 12.02] |
rmp | 7 [ -13%] | 7.30 [ 6.99 - 7.74] | 11.07 [ 10.78 - 11.70] | 17.45 [ 17.09 - 18.37] |
protobuf (schema) | 13 [ +62%] | 12.05 [ 11.74 - 12.80] | 5.91 [ 5.74 - 6.42] | 18.02 [ 17.50 - 19.19] |
json | 17 [+112%] | 10.68 [ 10.50 - 12.46] | 22.46 [ 22.05 - 23.62] | 34.82 [ 34.23 - 60.41] |
bson | 19 [+137%] | 16.97 [ 16.66 - 17.28] | 42.52 [ 41.85 - 47.99] | 60.10 [ 58.70 - 69.23] |
cbor | 8 [ +0%] | 15.81 [ 15.70 - 16.18] | 59.24 [ 58.39 - 61.95] | 69.63 [ 68.21 - 70.32] |
simd_json | 17 [+112%] | 10.24 [ 9.92 - 10.54] | 112.17 [102.62 - 155.85] | 127.21 [118.65 - 164.30] |
flexbuffers | 17 [+112%] | 110.84 [108.56 - 114.05] | 45.89 [ 45.12 - 71.19] | 173.46 [168.91 - 198.21] |
toml | 16 [+100%] | 95.85 [ 93.15 - 102.19] | 256.90 [247.26 - 288.81] | 379.74 [371.73 - 462.67] |