Garbage collection in D

Robert Fraser fraserofthenight at gmail.com
Thu Jun 4 07:15:17 PDT 2009


bearophile wrote:
> Yes, for such tiny benchmarks I have seen several times 10-12 higher allocation performance in Java compared to D1-DMD. But real programs don't use all their time allocating and freeing memory...
> 
> Bye,
> bearophile

For the compiler I'm working on now (in D), I wanted to check the 
affects of allocation on performance. Using a placement new, the time 
for lex/parse/semantic/type-infer/codegen (on a really huge in-memory 
file) went from ~6 seconds to ~4 seconds (don't have the exact timings, 
and can't repro right now since I'm redoing inference). So I'd say that 
even in real-world applications, these things have an effect.

Of course, this only applies to programs which allocate and throw away a 
lot of small objects. This is a style encouraged by Java and C#'s 
programming models, much less so by, say, C++'s.


More information about the Digitalmars-d-learn mailing list