Serialization woes

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Apr 18 08:02:28 PDT 2012


On 4/18/12, Masahiro Nakagawa <repeatedly at gmail.com> wrote:
> You can use direct-conversion deserialize
>
>      Foo foo2;
>      msgpack.unpack(data, foo2);
>
> instead of
>
>      msgpack.unpack(data).as!(typeof(foo));
>
> I tested your code on my Mac.
> Direct-conversion deserialize is 2x or 3x faster.

Wow, I had no idea there was a direct-conversion routine.

On my machine here's the results, first the indirect conversion:
globals.d(358): saved headers in 2327 msecs
globals.d(364): loaded headers in 82058 msecs

then the direct conversion:
globals.d(358): saved headers in 2581 msecs
globals.d(364): loaded headers in 4260 msecs

That's almost a 20x speed improvement! Fantastic, this solves my
problems! But what exactly is the difference between the two
deserialization routines except the speed itself?


More information about the Digitalmars-d mailing list