4 ms·
You realize the latency excursion needed to deterministically free a large data structure is also problematic, exacerbated by the background data structure need
by mcguire 8y ago
You realize the latency excursion needed to deterministically free a large data structure is also problematic, exacerbated by the background data structure needed to manage allocation and deallocation. (Not all data structures can be "small".)
Further, manual heaps tend to scatter your small blocks all over your address space, making your heap work harder as well as doing bad things to your caches. (Unless you go to the work of building cache-aware data structures, which most developers are not capable of considering that they have problems with the discipline needed to make manual management work at all.)
- ajross 8y agoOf course, but it's treatable. Large applications deployed on traditional heap implementations do not, as a general rule, suffer from the kind of GC tuning voodoo that plagues the JVM and which inspired ZGC and Shenandoah (and two decades of their ancestors!). There's no free lunch, but if you know heap behavior is a performance issue in a giant C++ app or whatever, you have a big list of tools with which to address it in software. And in practice this works. Large deployments of, say, PostgreSQL don't require that the admins tune the allocation strategy of the process or carefully size the heap memory internal to the process (obviously there is external tuning at the OS level, though).
- mcguire 8y agoIt's treatable, but not while maintaining deterministic behavior. And I'm a little unclear what the difference in practice is between "GC tuning voodoo" and "a big list of tools". ("external tuning at the OS level" ?= that's not one of your big list of tools)
- spullara 8y agoIf you haven't measured the difference between different allocators for your C++ programs you are probably using the wrong one. The system allocator can be 2-5x slower than an allocator that more closely matches your workload.
- pron 8y agoThere are always tools that help you improve performance, be it with code changes or tuning. The question is how much effort is required to achieve the required performance. I think that the past twenty years have shown that for a huge portion of server applications, GCs are the approach most developers prefer.
- afiori 8y agoThis is a point I very much like. One of the benefits of more abstraction is that "sufficiently smart" compilers/interpreters can do a lot of reordering/optimizations at a lower level that would otherwise need to be (unsafely) done by hand. I really like the Rust approach, but (I believe) it is impossible so have heap compacting at run time in practice and similar things. There was here an article about SQL that pointed out how Oracle would give you estimates of run time for a query, choose the estimated best data structures and algorithms, and also switch on the fly if it realizes the query was taking to long. As another example of the kind of techniques that are possible only from a higher abstraction.
- erik_seaberg 8y agoLiveness is a global property. A cache-aware data structure requires understanding the code that maintains it, but safely freeing an escaped object requires understanding all code everywhere that could possibly be using it, and we can't seem to find anyone who can actually do it without a hell of a lot of proof automation (or falling back to runtime checking).