More embarrassing microbenchmars for D's GC.

Steven Schveighoffer schveiguy at yahoo.com
Wed Sep 15 13:51:21 PDT 2010


On Wed, 15 Sep 2010 15:53:38 -0400, Rounin <davidjo at student.matnat.uio.no>  
wrote:

> I found this posting after investigating a huge slowdown in a D program  
> I'd made
> using gprof, which showed the culprit to be a function called
> _D3gcx3Gcx4markMFPvPvZv, in which the program spent 87% of its time.  
> That turned
> out to be the garbage collector.
>
> The program takes 1.74 seconds to run with two particular input files in  
> Python.
> The garbage collected D version takes 5.27 seconds.
> The non-garbage collected version takes only 0.68 seconds.
>
> Here's a more detailed report:
>
> http://rounin.livejournal.com/21815.html
>
> Obviously, the compiled program should run at least as fast as Python,  
> so the
> garbage collector could use some improvement.

gdc is very old.  You may want to try the thing on the latest dmd.  No  
guarantee this is going to help though.

Another thing you may want to try is dcollections HashMap instead of  
builtin associative arrays, as they use a free-list style allocator that  
helps avoid GC collections.

I agree the GC is a major issue with performance, I hope after D2 is a bit  
more stable, we start working on improving it.

-Steve


More information about the Digitalmars-d mailing list