Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-10-23 08:24:54


On Mon, October 23, 2006 14:08, Vladimir Prus wrote:
> Ovanes Markarian wrote:
>
>> Hello,
>>
>> we have some application, where boost::shared_ptr is extensively used.
>> After profiling with gprof I got that the shared_ptr destructor is very
>> expensive. I used following g++ compiler flags to compile:
>>
>> -Wall -ftemplate-depth-50 -fexceptions -fexpensive-optimizations -O3
>
> It's not a good idea to use gprof to profile C++ applications. Try
> callgrind.
>
>> Are there may be some MACRO-defs, which can enable/disable some additional
>> optimizations?
>
> BTW, you did not say which platform you are on.
>
> - Volodya
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

I used callgrind as well and it shows that the call to shared_ptr destructor is pretty expensive.
I used to create some 100000 object instances and it called 370000 time the destructor. I assume
the problem is in virtual function calls of the destructor which can not be inlined. Are there may
be some alternatives? Like defining an own shared_counter policy?

I am using RedHat with kernel: 2.6.9-22 and g++ 3.4.4

Apropos: This goes to Vladimir personally but not related to this post. Did you see my posting
with pointing to a small bug in the current (1.33.1) and CVS contained version in program_options.
Formating there fails sometimes.

With Kind Regards,

Ovanes Markarian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net