adam-dot-cohen / HyperSerializer

Dot Net Binary Serializer - 17x faster than Protobuf and Messagepack, 2x faster than MemoryPack
Apache License 2.0
61 stars 5 forks source link

Add support for dictionaries #1

Open dlgob007 opened 2 years ago

dlgob007 commented 2 years ago

Before I start complaining....my company serializes petabytes to disk per hour using MessagePack. The amount of compute HyperSerializer is going to save us is INSANE. Now for the complaining...

The serialize method throws a TypeInitializationException when I try to serialize dictionaries containing value types for both key and value. The following is the code to reproduce:

var dic = new Dictionary<int, int>() { { 1, 2 }, {3, 4}};
var bytes = HyperSerializer<Dictionary<int, int>>.Serialize(dic);
adam-dot-cohen commented 2 years ago

Support for dictionaries and classes with properties that are complex types is planned but currently unsupported (see "Limitations" section for more details). I plan on adding support for both of the aforementioned as soon as I can spare a day or two. It shouldn't be that heavy lift so possibly sooner, but the it started as a quick and dirty research project so the codebase isn't winning any beauty pageants.

If you're feeling ambitious and want to get involved to speed things up, let me know!