As suggested by PR #83, Bond serialization would actually be a great addition to the CacheManager "family".
I already did a first implementation to get started: d4b88b6
There is quite a lot of detail to it, and some things are still tbd. Especially regarding performance optimizations (https://microsoft.github.io/bond/manual/bond_cs.html#performance)
Goal for the different implementations would be to have different extension methods for the ConfigurationBuilder to let the user choose which Bond serializer to use.
The underlying implementation will probably be able to share 90% of the code...
edit: done in c842400
In general, Bond serialization has a lot of limitations compared to Json or even Protobuf. Like, it cannot serialize primitives (string, int), only classes representing a schema.
But it comes with a really good performance and memory footprint.
Here are some benchmark results to get an idea (source can be found here: https://github.com/MichaCo/CacheManager/blob/dev/test/CacheManager.Benchmarks/SerializationBenchmark.cs):
| Method |
Mean |
Scaled |
Allocated |
| JsonSerializer |
319.7445 us |
1.00 |
157.08 kB |
| BinarySerializer |
498.2847 us |
1.56 |
327.16 kB |
| JsonGzSerializer |
1,018.0015 us |
3.19 |
312.9 kB |
| ProtoBufSerializer |
135.8551 us |
0.43 |
152.68 kB |
| BondBinarySerializer |
85.7551 us |
0.27 |
65.41 kB |
| BondFastBinarySerializer |
83.4832 us |
0.26 |
65.7 kB |
| BondSimpleJsonSerializer |
232.3750 us |
0.73 |
160.55 kB |
As suggested by PR #83, Bond serialization would actually be a great addition to the CacheManager "family".
I already did a first implementation to get started: d4b88b6
There is quite a lot of detail to it, and some things are still tbd. Especially regarding performance optimizations (https://microsoft.github.io/bond/manual/bond_cs.html#performance)
objectalways causes all kinds of issuesGoal for the different implementations would be to have different extension methods for the
ConfigurationBuilderto let the user choose which Bond serializer to use.The underlying implementation will probably be able to share 90% of the code...
edit: done in c842400
In general, Bond serialization has a lot of limitations compared to Json or even Protobuf. Like, it cannot serialize primitives (string, int), only classes representing a schema.
But it comes with a really good performance and memory footprint.
Here are some benchmark results to get an idea (source can be found here: https://github.com/MichaCo/CacheManager/blob/dev/test/CacheManager.Benchmarks/SerializationBenchmark.cs):