Do shared pointers incur performance penalties?
I've been considering using shared pointers (e.g., Boost Smart Pointers) but want to know in what situations they would incur performance penalties. I need to write some programs where execution speed is very important. Can someone enlighten me on this?
Re: Do shared pointers incur performance penalties?
Quote:
Originally Posted by msgboardjunkie
I've been considering using shared pointers (e.g., Boost Smart Pointers) but want to know in what situations they would incur performance penalties. I need to write some programs where execution speed is very important. Can someone enlighten me on this?
Yes they do. Here are Boost's own timings,
http://www.boost.org/doc/libs/1_36_0...smarttests.htm
In my experience in the general case the code safety and ease of use of a shared smart pointer vastly outweigths the overhead.
But there's a grayzone when you want some more speed and is willing to trade in some flexibility and ease of use for speed. Then I use an intrusive smart pointer.
Finally there's the extreme case when speed is all important or smart pointers cannot be used because of cyclic references. Then raw pointers rule.
Re: Do shared pointers incur performance penalties?
Wow! thank you so much. this is a great article!
Re: Do shared pointers incur performance penalties?
Probably not the best place for that question, anyways:
I'm working with qt from its very first release. Now, that NOKIA bought the whole Trolltech, it's getting too expensive. I heard a lot of good things about BOOST. Any recommendable source??
Thanks and best from the south.
Re: Do shared pointers incur performance penalties?
Woh, Nokia had bought QT. This is a sad news to us.
Re: Do shared pointers incur performance penalties?
Quote:
Originally Posted by ariell
Probably not the best place for that question, anyways:
I'm working with qt from its very first release. Now, that NOKIA bought the whole Trolltech, it's getting too expensive. I heard a lot of good things about BOOST. Any recommendable source??
Thanks and best from the south.
It's considered rude to hijack other people's threads.
Anyway Qt is a GUI and Boost doesn't offer a GUI. Check out wxWidgets. It's an open source portable GUI.