Hacker News new | ask | show | jobs
by kaba0 1874 days ago
False. The JVM already does quite a good job with escape analysis, and record types just add extra semantic information to potentially further improve the situation.
2 comments

Counterpoint: Java programs with memory consumption graphs that have decided sharktooth patterns, which is extremely common.
As opposed to what exactly? How would a C program’s memory graph look with quick bursts of memory-allocation requiring functionality, especially if it is very dynamic in nature? Yeah you can overallocate with memory pools and the like, and there are cases of course where escape analysis can’t help — that’s why Valhalla is in the works for quite some times now.

But GC-wise the JVM is far ahead the game, whatever you see is likely better than the same functionality would be under JS, Python, C#, Go, etc (though the latter two do have value types/structs already so they can at some place manually do the “escape-analysis”. But not every problem requires/can use value types either)

Value types are essential element of design to me, but this is not widely recognized yet. To me it’d be like saying primitive types are not essential.
What precisely of what I said is “false”?
the JVM does something of the sort right now.
Every time you rebuild a record you run through its constructor. I doubt this can be optimized the same as with a plain C struct.

Eventually with some more evolution. But not yet.