-
Notifications
You must be signed in to change notification settings - Fork 527
Description
SolveSpace would benefit from a file format that suits the following required properties:
- compact, with a binary representation;
- has an alternate text representation, for tests;
- fast to read and write;
- easily extensible, while being backwards compatible;
- easily supports deeply nested structures, such as for hierarchical sketches.
In addition, an optional but desirable properties would be:
- easily readable and perhaps even writable from 3rd party software.
The current file format fulfills none of the above (not even the last requirement, since there is no explicit schema). I propose to replace it with a format based on Google Protocol Buffers, which has the following properties:
- the binary representation is naturally compact--it writes your data and generally does no special tricks during it, except that it defines a variable-length encoding for integers;
- the text representation is available alongside binary representation, and requires no manual work;
- has a highly optimized reader and writer implementation in C++;
- is literally designed because of a desire to handle protocol evolution well;
- is naturally nested;
- has a separate schema and very broad library support.
Such a format, with the initial version closely resembling the existing file format, seems like an ideal choice for us. The plan is to evolve it further by gradual extension, while remaining compatible with the old versions, as opposed to versioning; unknown entries are, generally, ignored, so with some care and testing, it is possible to retain an excellent degree of compatibility.