News for hackers. Stuff that matters.
Re:Reference count, don't garbage collect by staticassertion on Saturday July 30, 2022 @06:10AM (#32285590)
> whatever the reference counting algorithm is doing can be emulated by the hand-optimised C++ code so that's just literally impossible.

shared_ptr and unique_ptr have pretty significant overhead and are common practice, even for optimized codebases, so I wouldn't say it's impossible at all.

Re:Reference count, don't garbage collect by mbrodersen on Saturday July 30, 2022 @09:01PM (#32292045)
You are 100% right. At some point I measured smart_ptr to be 25x slower than raw pointers. The compiler I am maintaining is not using C++ style smart pointers. It is using a global whole program optimisation pass to reduce reference manipulation to a minimum. Basically what a world class C++ programmer with years of experience optimising performance would do. It is just done automatically.
Re:Reference count, don't garbage collect by tpolzer on Saturday July 30, 2022 @05:11PM (#32290378)
unique_ptr is nearly overhead free compared to a bare pointer (except for argument passing... because of ABI concerns).

shared_ptr is expensive and easy to build leaks with, so a lot of code bases avoid it where possible. Though it's only expensive when you copy it, moving it is ~free.

Re:Reference count, don't garbage collect by staticassertion on Saturday July 30, 2022 @05:44PM (#32290658)
This is just a more detailed version of my point lol you just listed the reasons they are not free.