Linked by Thom Holwerda on Thu 6th Sep 2012 21:32 UTC, submitted by MOS6510
Benchmarks "During the 4th Semester of my studies I wrote a small 3d spaceship deathmatch shooter with the D-Programming language. It was created within 3 Months time and allows multiple players to play deathmatch over local area network. All of the code was written with a garbage collector in mind and made wide usage of the D standard library phobos. After the project was finished I noticed how much time is spend every frame for garbage collection, so I decided to create a version of the game which does not use a GC, to improve performance."
Permalink for comment 534171
To read all comments associated with this story, please click here.
RE: yes... but why?
by ebasconp on Fri 7th Sep 2012 03:36 UTC in reply to "yes... but why?"
ebasconp
Member since:
2006-05-09

I prefer outsource memory management to a bot and use the expensive programmer's time to do something else.


That comment is almost totally accurate. I say ALMOST, because:

1. The programmer still must handle the memory at some extent in managed languages: he needs to make sure that his unused objects are not being referenced for any reference, he needs to use weak references or he needs to call explicitly to the garbage collector [I remember I had a problem with a behavior similar to a memory leak in C# that occurred because my big array was stored as a 2nd generation object, so the garbage collector did not clean it in a timely fashion; or remember having some "loitering objects" in Java because I forgot to remove some listeners after my frames were closed].

2. Though memory is handled automatically by the garbage collector, other resources are not, so, they still need to be managed by the programmer (file handles, registry handles, database connections, window handles, locks, etc. etc.). This inconsistency makes me crazy because you need to call .Dispose() explicitly or need to enclose your code in a "using" statement to free system resources (but not memory). Handling all resources in a good way has the same complexity that handling memory. Using best practices in C++ avoids this problem because any system resource (including memory) is handled automatically and in a deterministic way using the RAII pattern.

3. Real good programmers will be productive no matter the language they will code on.

Edited 2012-09-07 03:55 UTC

Reply Parent Score: 6