Advertisement
Guest User

Untitled

a guest
Apr 17th, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.58 KB | None | 0 0
  1. import std.conv;
  2. import std.stdio;
  3. import std.datetime;
  4. import msgpack;
  5.  
  6. struct A {
  7.     int x;
  8. }
  9.  
  10. struct Foo
  11. {
  12.     A[string] a;
  13. }
  14.  
  15. void main()
  16. {
  17.     Foo foo;
  18.     foreach (a; 'a' .. 'z')
  19.         foreach (b; 'a' .. 'z')
  20.             foreach (c; 'a' .. 'z')
  21.                     foo.a[to!string(a) ~ to!string(b) ~ to!string(c)] = A();
  22.  
  23.     auto sw = StopWatch(AutoStart.yes);
  24.     ubyte[] data = msgpack.pack(foo);
  25.     writeln(sw.peek.usecs);
  26.    
  27.     auto sw2 = StopWatch(AutoStart.yes);
  28.     msgpack.unpack(data).as!(typeof(foo));
  29.     writeln(sw2.peek.usecs);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement