Paul,
> Looking at the links to msgpack and the protobuf it seems to me that
> msgpack has much wider support for different languages.
Direct support (from Google) is only for C++, Java, Python, Objective-C,
C#, JavaScript, Ruby, Go, PHP and Dart. However, the language support
does not end there, see:
https://github.com/protocolbuffers/protobuf/blob/master/docs/third_party.md
Hell, how I am supposed to know? I am not the Pascal SDK developer. I
thought that you would tell me.
AFAIK, the project you pointed out is not the sole option, see:
https://github.com/lalexs75/protobuf-fpc
So I know about at least 4 options for Pascal/Delphi, but I really don't
have time nor Pascal expertise to evaluate and judge them.
> I also tried to find comparisons between the msgpack and protobuf
> but didn't come up with anything solid. Unless a site that claims ION
> is faster than any of the competition. But adding more protocols to
> the discussion is probably not helpful.
Well, MessagePack is more close to JSON than protobuf, just more compact
over wire. The main difference between these two is that protobuf uses
static schema to describe the content and code to serialize/deserialize
them is generated while msgpack is just a data serialization format, and
it's up to the developer to handle all semantics.
> Anyway, I think you need to choose the one that has the best overall
> fit for the project. It is too early for me to tell which one would
> be best for FreePascal.
Well, that is the problem. I can evaluate the protocol only from Python
perspective. So I can easily pick up a protocol that works best in
Python but would give a headache to developers using other languages.
Here are conditions where such system would be used:
1. High traffic.
2. Quick data exchange between peers.
3. The schema of the transmitted data is predominantly stable. However,
a large number of individual schemes is expected. One message could use
multiple ones, even nested.
4. Each schema could change over time, so proper handling of versioning
is essential.
5. Extensible.
These conditions could be translated into next characteristics we need:
1. Fast serialization/deserialization in all languages. It does not need
to be equally fast in all languages, but it should be rated among 3
fastest options for each particular language.
2. Efficient, compact "wire" format.
3. Use of static schema is preferred, otherwise the schema has to be
handled in upper layer (like wrapper classes for example).
4. Should support all essential (used by us) data types, or allow easy
and efficient handling of those that are not directly supported.
Essential types beyond standard numeric, string, bytearray and boolean
types are:
- timestamp, duration
- list
- map (all basic types should be available for key values, all essential
types should be available for values, single map should handle values of
more than single value type)
- raw - encapsulation of unrecognized payload
5. Should allow detection of unserialized/unused parts of particular schema.
AFAIK both protobuf and msgpack more or less fit these requirements.
protobuf fits it better for all directly supported languages, but we
don't know how well it fits in Pascal. The general problem with protobuf
is that generated code could be shity and cumbersome. In this aspect,
the quality of generated Python code is acceptable for me, can't judge
Java, C#, Pascal and others.
Using MsgPack would require us to handle schemes in manually written
code for each language, and schema definition would be also more harder
than writing a self-describing proto file with comments. With volume of
schemes and versioning issues it could easily escalate to developer's
nightmare over time.
Well, and there are other options like FlatBuffers etc. that could be
also considered and discussed, but from those I checked the protobuf &
msgpack are IMHO first hot candidates to consider, but its just my
personal opinion.
So, where we'll go from here? MsgPack would be easier to start with, but
we will pay greatly for that by hard work. protobuf could be harder to
start with, but could spare us from a lot of tedious work. What poison
we will choose? Personally, I incline to second option, but can live
with either one.
regards
Pavel