|
|
|
|
|
by SirYwell
1089 days ago
|
|
Allocation + deallocation might have more overhead together. I'll try to rephrase: Requesting an object from a pool might have more overhead than allocating a fresh object, and deallocating the object doesn't happen on an application thread but on a GC thread (depending on the GC, obviously).
Alexksey Shipilev has good resources how GCs in HotSpot typically allocate objects (https://shipilev.net/jvm/anatomy-quarks/4-tlab-allocation/). There definitely are scenarios where pooling might make sense, but basically the low hanging fruits in that area in minecraft are already reaped. |
|
For sure there are other tradeoffs, and whether it is worth it. But when we actually see many GB/s that is not cheap even if you are able to offload to other cores.
The article also concludes:
>It is funny to consider that having TLABs is the way to experience more frequent GC pauses, just because the allocation is so damn cheap!
Sounds like a nightmare, the problem just snowballs, because now you'll be tempted to get into GC tuning.