The GC and performance, but not what you expect
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Thu May 29 22:46:03 PDT 2014
On 5/29/14, 4:03 AM, Wanderer wrote:
> It will be hard to beat Java's garbage collector. They use generational,
> sequential memory approach, while D's memory manager (correct me if I'm
> wrong) uses more common approach and has to deal with possible memory
> fragmentation. Allocating a new object is extremely cheap in Java,
> literally a few machine instructions, and there is no locking because
> each thread has its own eden memory and they never overlap.
>
> Unless D introduces the possibility to move objects around in heap
> (which is not possible with the support of pointers, I guess) and
> eliminate the fragmentation, it will be hard to make GC as fast. Just 3%
> of difference look great enough to me. :-)
Thing is the allocation patterns in D and Java are mightily different.
Java does need a good GC because it allocates everywhere for everything.
I think we need to come up with our own measurements and statistics when
it comes about collecting D's litter.
Andrei
More information about the Digitalmars-d
mailing list