Garbage collection in D

Diwaker Gupta diwaker at floatingsun.net
Tue Jun 2 17:40:11 PDT 2009


I've just started to play around with D, and I'm hoping someone can clarify this. I wrote a very simple program that just allocates lots of objects, in order to benchmark the garbage collector in D. For comparison, I wrote the programs in C++, Java and D:
C++: http://gist.github.com/122708
Java: http://gist.github.com/122709
D: http://gist.github.com/121790

With an iteration count of 99999999, I get the following numbers:
JAVA:
0:01.60 elapsed, 1.25 user, 0.28 system
C++:
0:04.99 elapsed, 4.97 user, 0.00 system
D:
0:25.28 elapsed, 25.22 user, 0.00 system

As you can see, D is abysmally slow compared to C++ and Java. This is using the GNU gdc compiler. I'm hoping the community can give me some insight on what is going on.

Thanks,
Diwaker


More information about the Digitalmars-d-learn mailing list