GC vs. Manual Memory Management Real World Comparison

Alex Rønne Petersen alex at lycus.org
Wed Sep 5 04:10:52 PDT 2012


On 05-09-2012 13:03, Benjamin Thaut wrote:
> I rewrote a 3d game I created during my studies with D 2.0 to manual
> memory mangement. If I'm not studying I'm working in the 3d Engine
> deparement of Havok. As I needed to pratice manual memory management and
> did want to get rid of the GC in D for quite some time, I did go through
> all this effort to create a GC free version of my game.
>
> The results are:
>
>      DMD GC Version: 71 FPS, 14.0 ms frametime
>      GDC GC Version: 128.6 FPS, 7.72 ms frametime
>      DMD MMM Version: 142.8 FPS, 7.02 ms frametime
>
> GC collection times:
>
>      DMD GC Version: 8.9 ms
>      GDC GC Version: 4.1 ms
>
> As you see the manual managed version is twice as fast as the garbage
> collected one. Even the highly optimized version created with GDC is
> still slower the the manual memory management.
>
> You can find the full article at:
>
> http://3d.benjamin-thaut.de/?p=20#more-20
>
>
> Feedback is welcome.
>
> Kind Regards
> Benjamin Thaut

Is source code available anywhere?

Also, I have to point out that programming for a garbage collected 
runtime is very different from doing manual memory management. The same 
patterns don't apply, and you optimize in different ways. For instance, 
when using a GC, it is very recommendable that you allocate up front and 
use object pooling - and most importantly, don't allocate at all during 
your render loop.

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org


More information about the Digitalmars-d-announce mailing list