An exegesis of Walter's reference counted slice

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 24 19:41:26 PST 2015


On 2/24/2015 4:41 PM, deadalnix wrote:
> Why ? There is very little chance that malloc + GC.addRange becomes any faster
> that GC.malloc in the first place.

1. GC is designed to do GC, which is more than malloc/free is designed to do. 
Less work usually is faster.

2. There are many malloc/free implementations available, and people can and do 
swap them out to find one that works best for their application. Also, compiler 
vendors often expend a great deal of effort making malloc/free work well. Why 
not take advantage of that? It's like it's pretty hard to compete with the 
system memcpy() - people expend enormous effort on that.


>> To have an arbitrary sub graph be memory safe with return ref, the interface
>> to it will have to be constructed to only allow access by values or return refs.
> That means all library code must be duplicated.

Why?


> but someone already made a very good point about it there:
> http://www.drdobbs.com/cpp/type-qualifiers-and-wild-cards/231902461

Don't see how that applies.



More information about the Digitalmars-d mailing list