Adding Microsoft Bond Serialization #127

Closed
MichaCo opened this Issue Feb 7, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@MichaCo
Owner

MichaCo commented Feb 7, 2017

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)

  • caching of the writer objects per type as those are expensive (per documentation)
  • pooling of the buffers passed into the serialization writer (typical byte array buffer pool)
  • TCacheValue being object always causes all kinds of issues
  • Basic unit tests
  • Polymorphism testing / impl for derived types
  • CompactBinary implementation
  • FastBinary implementation
  • SimpleJson implementation
  • SimpleXml implementation
  • Configuration json schema update for known serializers

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

@MichaCo MichaCo self-assigned this Feb 7, 2017

@MichaCo MichaCo added this to the Version 0.9.4 milestone Feb 7, 2017

@MichaCo MichaCo added the enhancement label Feb 7, 2017

@MichaCo MichaCo modified the milestones: Version 1.0, Version 0.9.4 Mar 18, 2017

@MichaCo MichaCo referenced this issue Mar 18, 2017

Open

Add Examples and update docs #137

0 of 6 tasks complete

@MichaCo MichaCo closed this Mar 18, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment