Mac Apps That Use Garbage Collection Must Move to ARC

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 26 12:14:44 PST 2015


On 2/25/2015 9:01 PM, deadalnix wrote:
> On Thursday, 26 February 2015 at 04:11:42 UTC, Walter Bright wrote:
>> On 2/25/2015 6:57 PM, deadalnix wrote:
>>> You seems to avoid the important part of my message : write barrier tend to be
>>> very cheap on immutable data. Because, as a matter of fact, you don't write
>>> immutable data (in fact you do to some extent, but the amount of write is
>>> minimal.
>>>
>>> There is no reason not to leverage this for D, and java comparison are
>>> irrelevant on the subject as java does not have the concept of immutability.
>>>
>>> The same way, we can use the fact that TL data are not supposed to refers to
>>> each others.
>>
>> Of course, you don't pay a write barrier cost when you don't write to data,
>> whether it is immutable or not is irrelevant.
>
> It DOES matter as user tends to write way more mutable data than immutable ones.
> Pretending otherwise is ridiculous.

I don't really understand your point. Write barriers are emitted for code that 
is doing a write. This doesn't happen for code that doesn't do writes. For example:

    x = 3: // write barrier emitted for write to x!
    y = x + 5; // no write barrier emitted for read of x!

How would making x immutable make (x + 5) faster?



More information about the Digitalmars-d mailing list