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 534378
To read all comments associated with this story, please click here.
RE[4]: GC is for scripting
by tanzam75 on Sat 8th Sep 2012 17:36 UTC in reply to "RE[3]: GC is for scripting"
tanzam75
Member since:
2011-05-19

If so, then you're making your own head explode. Because I never wrote that.

I pointed out that the student was complaining about "precisely the scenario" that performs better under GC than without GC, and then said that "no wonder" he ran into problems when he took out the GC.

In other words, you will write your code differently if you have a GC, compared to if you do not have a GC. If you have a GC, you do not worry too much about short-lived objects, but worry a great deal about medium-lived objects. If you do not have a GC, then you do not worry too much about medium-lived objects, but must take care to avoid excessive overhead from constructing and destructing short-lived objects.

Since the student directly ported code that assumes a GC, it is not surprising that he ran into problems when he took out the GC. Indeed, by tailoring the code to the non-GC platform, he was able to eliminate the performance penalty.

It's puzzling how you make the leap from that to the straw man that "high performance and non-leaking code can only be achieved by using a GC."

Edited 2012-09-08 17:38 UTC

Reply Parent Score: 3