Newbie initial comments on D language - scope

Sean Kelly sean at f4.ca
Sat Feb 2 11:24:45 PST 2008


Janice Caron wrote:
> On 2/2/08, Walter Bright <newshound1 at digitalmars.com> wrote:
>> Doing locked reference counts is slow
> 
> Surely you don't need to lock the reference count? You can use atomic
> increment and atomic decrement instead. (I implemented a ref-counted
> template in C++ once, and that's what I did. It seemed to work).

A locked operation on x86 takes something like 80ns, which is far from
cheap.  Though I think a cleverly implemented algorithm may be able to
avoid the use of 'lock' altogether (Boost's does, IIRC).


Sean



More information about the Digitalmars-d mailing list