Boost logo

Boost :

Subject: Re: [boost] [Smart Ptr] make_shared slower than shared_ptr(new) on VC++9 (and 10) with fix
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2012-04-25 18:59:03


[Mathias Gaunard]
> std::shared_ptr is probably optimized for empty or default deleters.

In VC10 and VC11, shared_ptr has five control blocks:

* vanilla
* custom deleter
* custom deleter and custom allocator
* make_shared
* allocate_shared

Each is optimally sized (in particular, make_shared/allocate_shared implement the "we know where you live" optimization that I have previously described in an attempt to get Boost to pick it up), except that we don't special-case empty custom deleters/allocators. In VC11, we've introduced such special-casing for container allocators/comparators, but we haven't had time to extend it to shared_ptr. I've made a note to myself to do this in the future.

(VC9 SP1 was so long ago - as I recall, it had the first three control blocks, but lacked make_shared/allocate_shared due to the absence of rvalue references.)

Stephan T. Lavavej
Visual C++ Libraries Developer


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk