Opened 10 years ago

Last modified 10 years ago

#6829 new Bugs

[smart_ptr] make_shared is slower than shared_ptr(new) in MSVC

Reported by: mt.wizard@… Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost Development Trunk Severity: Optimization
Keywords: smart_ptr make_shared Cc: mt.wizard@…

Description

boost::make_shared() works much slower than it supposed to in MSVC It uses RTTI to get its custom deleter, and RTTI is painfully slow in MSVC.

Attachments (2)

make_shared_perf.patch (59.2 KB ) - added by mt.wizard@… 10 years ago.
More optimal implementation of make_shared: don't use RTTI and don't store exptra pointer to allocated object as its position is know without it
make_shared.hpp (31.8 KB ) - added by ierceg@… 10 years ago.
Updated smart_ptr\make_shared.hpp file to look more like the original implementation and with sp_enable_shared_from_this calls that were missing in the patch.

Download all attachments as: .zip

Change History (4)

by mt.wizard@…, 10 years ago

Attachment: make_shared_perf.patch added

More optimal implementation of make_shared: don't use RTTI and don't store exptra pointer to allocated object as its position is know without it

comment:1 by mt.wizard@…, 10 years ago

Component: Nonesmart_ptr
Owner: set to Peter Dimov
Severity: ProblemOptimization

by ierceg@…, 10 years ago

Attachment: make_shared.hpp added

Updated smart_ptr\make_shared.hpp file to look more like the original implementation and with sp_enable_shared_from_this calls that were missing in the patch.

comment:2 by anonymous, 10 years ago

Is there any way to remove attached file here? Please don't use the make_shared.hpp from attachment.

Note: See TracTickets for help on using tickets.