3 ms·
BTW: Here is the post of someone who thought he can use shared_ptr as a poor-man's GC: http://stackoverflow.com/questions/2502394/the-cost-of-passing-by-shared-
by pkolaczk 13y ago
BTW: Here is the post of someone who thought he can use shared_ptr as a poor-man's GC: http://stackoverflow.com/questions/2502394/the-cost-of-passing-by-shared-ptr http://stackoverflow.com/questions/2502394/the-cost-of-passi...
shared_ptr took 17% of time. This is far beyond what GC takes even in a very memory heavy Java application (typically GC stays below 1% overhead).
I'm not saying you shouldn't use shared_ptr at all, but only: be careful.
- detrino 13y agoNovices also sometimes erroneously pass std::vector by value, that doesn't mean std::vector is slow. Maybe you did not read the entire post before linking it. The conclusion was he changed his code to pass by reference and 17.77% became .27%.
- eliasmacpherson 13y agoThanks for pointing that out, I had heard horror stories before and was willing to take 17.77% at face value!