Originally posted by bnolsen
View Post
At last, did you see the C++ 11 talk by the C++ creator, Stroustup? (here: http://channel9.msdn.com/Events/Goin...-Design-for-C- )
He seemed to not advertize to use extensively the smart pointers, but just for cases of shared instances. So maybe there is a common wisdom in which C++ performance of reference counting should be avoided as much as possible by avoiding using smart pointers at least extensively.
Compare this with .Net/Java's GC at least (and to some extend to the D's one): you don't care this much of the GC, you don't get penalty performance as you iterate over a collection of references, if you don't do any allocation, you don't have to declare your references const & almost everywhere because there may be a performance issue.
So, as for your application: - how many algorithms you've been using do care about ref-counting? I wrote one small application which generates C++ code (you know, these code generators), and it was using smart-pointers, and the performance of that application, before I started to optimize the reference counting copying and initialization, the application was running roughly 10 times slower (so 9/10 of the time was basically update and decrement reference counting). Sure, this is the worst of the worst in the code generator (so I don't blame ref-counting in itself), but the same (unoptimized code), if the generated code was Java, maybe it would be 8 times faster (I never rewrote the code to export Java, but this is a fair estimate).
Comment