4 ms·
Modern C++ means usage of reference counting (smart pointers), in some cases reference counting can be slower than a garbage collector.
by fetbaffe 6y ago
Modern C++ means usage of reference counting (smart pointers), in some cases reference counting can be slower than a garbage collector.
- bluGill 6y agoIn modern C++ the reference count is always 1 or 0 for 80% of the code and so there is no need to actually maintain the count. That other 15% needs a count which I agree is slower than gc done right. The final 5% has cycles and cannot be done by reference count.
- dirtydroog 6y agoNot really. Only shared_ptr uses ref counting, unique_ptr doesn't, and looking at our code base (highly networking orientated) we only use shared_ptr once. You could, in theory, use shared_ptr everywhere, but then you're not using the language properly and may as well resort to Java or similar.