3 ms·
There's a certain amount of work that has to be done for GC, and that work is going to be done somewhere. The question is just what trade-offs you want. Don't
by jdmichal 10y ago
There's a certain amount of work that has to be done for GC, and that work is going to be done somewhere. The question is just what trade-offs you want.
Don't want compacting? You'll pay for it in allocation.
Don't want pausing? You'll pay for it in application threads.
- pcwalton 10y agoPrecisely, and this is what is so often missed in these discussions. Most of the time, when you see claims of GC silver bullets, there's some hidden downside that's being papered over. Latency wins (i.e. "max pause time" or whatnot) tend to be throughput losses. Less copying results in more fragmentation. Value types can result in more copying, reducing performance over pointer indirections through nursery allocations. And so forth.
- weberc2 10y agoI don't know that anyone disputes this. The discussions I participate in don't deny this; they mostly talk about whether or not the tradeoffs result in a net gain (if you sacrifice a little from the minority of cases to gain the same amount in the majority of cases, you do indeed have a net gain). > Value types can result in more copying, reducing performance over pointer indirections through nursery allocations Having value types means you can pass by copy, but it also means you can allocate on the stack and pass by reference--in other words, you get performant passing without involving the GC.
- cliffc 10y agoNearly all the work you allude to is done in other threads - which indeed consume machine resources (CPU cycles, memory bandwidth). If your application does not burn all cores/bandwidth then the GC work is all done on the idle/spare machine resources. At the limit though, indeed you'll have to slow down the Application so that GC can play catchup - and bulk/batch stop-the-world style GC's require less overhead than the background incremental GCs Cliff