Disable GC entirely

Rob T alanb at ucora.com
Sat Apr 6 09:19:51 PDT 2013


On Saturday, 6 April 2013 at 08:01:09 UTC, Adrian Mercieca wrote:
>
> In my very simple test, the GC version of my program ran more 
> than twice
> slower than the non GC version. I just cannot accept that kind 
> of
> performance penalty.
>
> Thanks.

I have ran into similar problems with D and understand what your 
are looking for, so far the only solution is to change the way 
you write your code. Automated memory management has pros and 
cons, you are witnessing the cons and I don't know if a better GC 
can really solve all of the cons.

In my case I have been able to mostly get around the problem by 
strategically disabling the GC during active memory allocations, 
and then re-enabling when all or most of the allocations are 
completed. In effect I'm doing manual memory management all over 
again because the automated version fails to do a good enough 
job. Using this technique I've been able to get near C++ 
performance speeds.

Part of the problem is that the GC implementation is simply not 
suitable for performance code and lacks fine tuning abilities 
(that I'm aware of). Without a decent brain, it does stupid 
things, so when you have a lot of allocations going on but no 
deallocations, the GC seems to be running needlessly slowing down 
the application by as much as 3x.

--rt


More information about the Digitalmars-d mailing list