Hacker News new | past | comments | ask | show | jobs | submit login

> a GC can be more efficient than direct heap allocations

Unoptimised, naive allocations perhaps. I'm old enough to still remember when Microsoft used similar line of reasoning to create artificial cases where C# beat C++ performance.




I would wager that the majority of C/C++ codebases (e.g. internal business code) use naive allocation. In C++ particularly, naive allocation (I might define this as straight up "has-a" ownership-based heap allocations and deletions) is considered best practice by many.


Not only that, shared_ptr is also popular in such codebases, and shared_ptr usually has an additional allocation to store reference count in the "control block".


shared_ptr is nothing more than low latency GC that can't handle cycles. It's the extreme end of the latency throughput tradeoff.


Given that most C++ code in modern Windows applications is for jungling COM instances, no need for artificial cases when every couple of lines there is a Release() or AddRef() call, with possible OS IPC in the middle.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: