new D2.0 + C++ language

Christopher Wright dhasenan at gmail.com
Thu Mar 19 15:21:11 PDT 2009


Weed wrote:
> Christopher Wright пишет:
> 
> 
>>>>>> And regarding performance, eventually it will come a lot from a good
>>>>>> usage of multiprocessing,
>>>>> The proposal will be able support multiprocessing - for it provided a
>>>>> references counting in the debug version of binaries. If you know the
>>>>> best way for language *without GC* guaranteeing the existence of an
>>>>> object without overhead - I have to listen!
>>>> You cannot alter the reference count of an immutable variable.
>>> Why?
>> Because it's immutable!
>>
>> Unless you're storing a dictionary of objects to reference counts
>> somewhere, that is. Which would be hideously slow and a pain to use. Not
>> that reference counting is fun.
> 
> 
> Precisely. I wrote the cost for that: 1 dereferencing + inc/dec of counter.

It's more expensive than dereferencing. If your const object points to 
its reference count, then the reference count is also const, so you 
can't alter it.

So the best you can possibly do is one hashtable lookup for every time 
you alter the reference count for a non-mutable variable. That is a huge 
overhead, much more so than garbage collection.



More information about the Digitalmars-d mailing list