CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2008
    Posts
    2

    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?

  2. #2
    Join Date
    Nov 2003
    Posts
    1,405

    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.
    Last edited by _uj; October 1st, 2008 at 09:43 AM.

  3. #3
    Join Date
    Oct 2008
    Posts
    2

    Re: Do shared pointers incur performance penalties?

    Wow! thank you so much. this is a great article!

  4. #4
    Join Date
    Oct 2008
    Location
    Tel Aviv, Berlin, L.A.
    Posts
    23

    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.
    ariell
    programming is understanding

  5. #5
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    Re: Do shared pointers incur performance penalties?

    Woh, Nokia had bought QT. This is a sad news to us.

  6. #6
    Join Date
    Nov 2003
    Posts
    1,405

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured