Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Microsoft Bond Serialization #127

10 tasks done
MichaCo opened this issue Feb 7, 2017 · 0 comments
10 tasks done

Adding Microsoft Bond Serialization #127

MichaCo opened this issue Feb 7, 2017 · 0 comments


Copy link

@MichaCo 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 (

  • 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:

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 modified the milestones: Version 1.0, Version 0.9.4 Mar 18, 2017
@MichaCo MichaCo closed this as completed Mar 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

1 participant