Mac Apps That Use Garbage Collection Must Move to ARC

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 24 01:50:16 PST 2015


On 2/23/2015 11:53 PM, Jacob Carlborg wrote:
> On 2015-02-23 21:30, Walter Bright wrote:
>
>> Count me among those.
>>
>> In Java, write barriers make sense because Java uses the GC for
>> everything. Pretty much every indirection is a GC reference.
>>
>> This is not at all true with D code. But since the compiler can't know
>> that, it has to insert write barriers for all those dereferences
>> regardless.
>
> The alternative would be to have two kind of pointers, one for GC allocated data
> and one for other kind of data. But I know you don't like that either.

That kinda defeats much of the point to having a GC.


>> I suspect it would be a terrible performance hit.
> It would be nice to have some numbers backing this up.

I've seen enough benchmarks that purport to show that Java is just as fast as 
C++, as long as only primitive types are being used and not pointers.

I've done enough benchmarks to know that inserting even one extra instruction in 
a tight loop has significant consequences. If you don't believe that, feel free 
to try it and see.

D is not going to have competitive performance with systems programming 
languages if write barriers are added.



More information about the Digitalmars-d mailing list