
Phil Bouchard wrote:
On 5/26/2011 3:02 PM, Phil Bouchard wrote: ...
xor %edi,%edi callq 0x405058 <_ZdlPv@plt> (operator delete) ...
On each iteration worker_make calls delete explaining why it is twice slower than worker_new. I'm not sure what it is deleting.
It looks like it calls delete with NULL. This is probably the destructor of the temporary auto_ptr, whose pointer is NULL after the assignment. Does your test use rvalue references by the way (-std=c++0x)? shared_ptr has a move assignment and should be able to take advantage of that to avoid some of the overhead imposed by the remaining temporary (-ies). Also, the trunk/release make_shared should be better than the one in 1.46.1 (although I don't know how relevant is this for such a small pointee as int.)