Thiago Macieira wrote:
> Performance considerations:
> * ref() does two 1-bit tests before the atomic increment
> * deref() does one 1-bit test before the atomic decrement
> * needsDetach() does one 2-bit test and a check for the refcount's value

I think these are the operations that can afford to be "expensive". All of them 
are done where we're potentially i) allocating memory and copying data (e.g. 
unsharable data), ii) destroying elements and releasing memory (e.g. last 
owner), or iii) detaching for mutating data (e.g., shared data).

needsDetach and condition iii) above is where we could potentially save some by 
skipping the checks altogether under fairly limited and user-controlled 
situations with the oft-mentioned ref-counted-but-not-checked base class.

Cheers,


João

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to