3 ms·
No, nothing can beat manual memory management in performance. GCs don't have a clue where and when they should make what trade offs, but programmers do.
by zzzcpan 10y ago
No, nothing can beat manual memory management in performance. GCs don't have a clue where and when they should make what trade offs, but programmers do.
- kibwen 10y agoGC can surpass the performance of manual memory management in certain situations, assuming that the manually managed code is forced to allocate for some reason. GCs almost universally use far more memory than manual schemes, though (I'm having a hard time imagining a counterexample).
- mmstick 10y agoThat depends on the allocator you are using. Rust bundles jemalloc by default, which organizes deallocations/allocations such that they are very efficient.
- jondot 10y agoYou mean a select few programmers do. And even if you've struck gold and all of your programmers are from the 90's so that they know what it means to manage memory manually, the landscape - the code - always changes and so will the trade off. The deal is that you want to deliver software quickly and make sure it performs adequately, but no one needs perfectly, in regular business.
- josephg 10y agoIt really depends on what sort of business you're in. If you're doing application development then UI performance is usually good enough using modern runtime environments and libraries. When this is true being able to release features quickly is the most important metric. But if you're working on a 3d game engine, writing a web browser, writing code on an embedded platform or writing a database then performance itself is a feature. Being lazy with allocation or your choice of algorithms is a really expensive mistake that will hurt your bottom line.