3 ms·
I would expect that any advantage the JVM gains from variable order fiddling (and variable dropping) is minimal. Whereas the problems we get on multicore system
by fmstephe 13y ago
I would expect that any advantage the JVM gains from variable order fiddling (and variable dropping) is minimal. Whereas the problems we get on multicore systems with false sharing, and other cache-line maladies, are significant.
This is, however, just what I expect to be the case. It may be that in practice the JVM is getting good results from fiddling with our variables.
You may be right that annotations would suit Java better than allowing programmers to layout objects as they wish. The strong motivation for this is that the fix would be simple (and perhaps have no serious downside?) and mean that work can be done without waiting for a JSR to reach maturity.
From what I read the state of the art around this is to use relatively unstable hacks which require very strong knowledge of JVM implementations - see the example code from Martin Thomson in the linked article.
You could still happily write your variables for humans in most cases. I would love to know how large the downside is to fixed variable ordering.