MIT Technology Review: An Interview With Bjarne Stroustrup

Dave Dave_member at pathlink.com
Wed Dec 6 20:22:14 PST 2006


zz wrote:
> 
> After fixing this problem here are my results on a different machine.
> 
>  From my point of view these tests are not really nessesary on my side 
> since I still continue using D and I belive that someday the memory 
> stuff will be optimized.
> 
> Zz
> 
> -------------------------------------------------------
> VS2003
> Element count: 1000000
> 
> ContextSwitches - 24787
> First level fills = 0
> Second level fills = 0
> 
> ETime(   0:00:05.328 ) UTime(   0:00:05.046 ) KTime(   0:00:00.187 )
> ITime(   0:00:04.828 )
> 
> -------------------------------------------------------
> VS2003 with nedmalloc
> Element count: 1000000
> 
> ContextSwitches - 8854
> First level fills = 0
> Second level fills = 0
> 
> ETime(   0:00:02.390 ) UTime(   0:00:02.218 ) KTime(   0:00:00.078 )
> ITime(   0:00:02.015 )
> 
> -------------------------------------------------------
> DMC
> Element count: 1000000
> 
> ContextSwitches - 35008
> First level fills = 0
> Second level fills = 0
> 
> ETime(   0:00:07.312 ) UTime(   0:00:07.000 ) KTime(   0:00:00.031 )
> ITime(   0:00:06.656 )
> 
> D change:
>     for(int i = 0; i < 1000000; i++)
>     {
>         d_element element = new d_element();
>         element.CreationDate = cd1 ~ "cd1";
>         element.Creator      = cd2 ~ "cd2";
>         element.Label        = cd3 ~ "cd3";
>         root.elements ~= element;
>     }
> 
> 

If the code is changed for both D and C++ to not cat the small strings:

     for(int i = 0; i < 1000000; i++)
     {
         d_element element = new d_element();
         element.CreationDate = cd1;// ~ "cd1";
         element.Creator      = cd2;// ~ "cd2";
         element.Label        = cd3;// ~ "cd3";
         root.elements ~= element;
     }

VC++: 2.609 (using NedAlloc)
DMD:  0.937

Pretty interesting. The opCatAssign seems very fast. opCat not.

Zz, I don't know how closely your test mimics the bottlenecks in your production code, but maybe if 
you could move things like that opCat out of loops in some cases, you'd get faster code than with 
ptr_vector<>?



More information about the Digitalmars-d mailing list