Do you have a JSON driver for Orange yet? Would be interesting to benchmark Orange against a purpose designed JSON serialization library.
If your design is mostly compile time the experiment would be very interesting (I think).




On Mon, Feb 17, 2014 at 12:03 AM, Jacob Carlborg <doob@me.com> wrote:
On 2014-02-16 21:45, "Nordlöw" wrote:
I believe it's worth the try to get Python-style serialization
simplicity to D by default. We use Python cpickle at work and its
fantastically simple and fast. It handles just about everthing you need
by default as long as you have imported the modules that contain the
types involved in the serialization.

It would attract more people from dynamical languages like Python if D
got default-powers in std.serialization that does everything that
msgpack does plus followings references.

This would make it possible to serialize arbitrary graph-likes
structures with potential reference cycles. Resolving these cycles can
be solved by using a map that contain a list of references/classs that
already have serialized.

I already have all this in Orange [1], which I'm in progress of adapting to a package for Phobos.


I'm however not sure how serialization of base and superclasses should
be implemented in the most convenient way. Maybe somehow has a good
suggestion for this.

This requires registering the subclass in some way. In my implementation one needs to call:

Serializer.register!(Sub);

For full example see [2].

[1] https://github.com/jacob-carlborg/orange
[2] https://github.com/jacob-carlborg/orange/wiki/Base-Class

--
/Jacob Carlborg