Serialization woes

Masahiro Nakagawa repeatedly at gmail.com
Tue Apr 17 22:23:55 PDT 2012


On Wednesday, 18 April 2012 at 03:32:47 UTC, Andrej Mitrovic 
wrote:
> On 4/18/12, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
>> On 4/17/12, Jacob Carlborg <doob at me.com> wrote:
>>> Feel free to use my serialization library and see what it can 
>>> handle:
>>> https://github.com/jacob-carlborg/orange
>
> Simple test-case:
> http://pastebin.com/dcnm4nmA
>
> That's around 15k keys. It takes 31 seconds to serialize. And my
> structures are full of these hashes, so it would likely take an
> eternity to serialize my structures with Orange.
>
> Here's msgpack-d:
> http://pastebin.com/wsRQPiDJ
>
> 6.3 milliseconds to serialize. But it takes 32 milliseconds to
> unserialize, which is 5x slower. On big data structures this
> difference becomes quite noticeable.

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.


More information about the Digitalmars-d mailing list