You mention a lot of workarounds and knobs though.
And the excessive use of layers of abstractions in the Java world is scary.
I you're looking for high throughput you just need to allocate less. Or use unsafe. And it's totally doable.
And the same approaches can be done in Java (e.g. self-managed off heap allocations), even more-so when they introduce value types.
func main() {
n := 1
fmt.Println(n)
}
Object pooling won't help here.The new GCs on the JVM have very few parameters to tune, I think Shenandoah or ZGC have only two parameters to set up, can't get much simpler.
Escape analysis was just rewritten, and the objective is to handle this case more gracefully.