R
Roedy Green
The performance gains are just tales from the early days of JIT.
My reason for using final is clarity. When I see a final I know there
can't be lurking later a redefinition. Whenever is see a "missing"
final I know to look for one.
With hindsight, I think "final" should have been the default for
temporary variables and parameters. You should have had to use a "var"
keyword to permit redefinition later.
Hotspot does some incredible footwork finding un-overidden methods and
treating them as final, then changing its mind in mid flight (part way
through evaluating an expression!) if a new class is loaded that
overrides them. Final methods can be more directly addressed. I am
blown away that it works.
--
Roedy Green Canadian Mind Products
http://mindprod.com
"The industrial civilisation is based on the consumption of energy resources that are inherently limited in quantity, and that are about to become scarce. When they do, competition for what remains will trigger dramatic economic and geopolitical events; in the end, it may be impossible for even a single nation to sustain industrialism as we have know it in the twentieth century."
~ Richard Heinberg, The Party’s Over: Oil, War, and the Fate of Industrial Societies