Description
Motivation
When working with Distributed Data, I came to the point when we need to serialize generic data types in efficient way - both in terms of performance and payload size. Protobuf is a no-go here: it's not able to store generic data. JSON is inefficient. Hyperion can deal with generics efficiently, but there's a catch.
Problem
Right now we are storing type information as a string. As someone pointed out this may be a security issue (we have the same for json.net). Regardless, there is another problem with storing types this way, and it's related to generics. This is something I need to verify, but the deal is:
Potentially we can make use of known types property of Hyperion to safe space (I'm not sure, but AFAIK type name is changed to int identifier). However known types won't be able to utilize this feature if we have generic type, because we need to have type written as a single value. Therefore having known type of Dictionary<,>
won't help us anywhere if we have to serialize Dictionary<string, int>
/Dictionary<string,string>
etc. as their type signatures don't match the one of known type.
Solution?
We could deal with it this way:
Instead of setting known type as a single key, in case of generics we could serialize it as a sequence of keys, i.e. 3-key sequence representing Dictionary<,>
/string
/int
which would be then composed into Dictionary<string,int>
. Each key could be cached separately.
This is only an idea and needs further investigation.