3 ms·
But you can also put generational GC on steroids by implementing escape analysis, which creates a separate category of allocations that don’t have to be marked
by hinkley 2mo ago
But you can also put generational GC on steroids by implementing escape analysis, which creates a separate category of allocations that don’t have to be marked and swept at all. Effectively they were marked the first time the code was run and never have to be marked again.
What people forget too is that new and destroy in C++ aren’t exactly cheap either. As far back as Java 5 the hotspot people were bragging on how new in Java was cheaper than new in C++, closer to stack allocation speed.
Of course if you look at any Java library other than ones intended for embedded or HFT systems, you will see Jevons’ Paradox at play. Made allocation cheap, and everyone allocates the hell out of everything, eating up the gains and then some.
But at the same time, the architectural simplicity of not having to worry about object lifetimes makes APIs simpler, which allows people to invest that brain power into making them more sophisticated in other dimensions. Watching Rust try to get itself doubly linked lists was strange to watch from the bleachers.