开发者

Final for function parameter optimization

Is there any n开发者_如何学JAVAoticeable optimization made by JVM when I add final to parameter in Java?


Short answer: no. Longer answer: nope.


It only helps you to make sure that you are not changing the reference to the objects passed through the parameters .. but with regards to the JVM, it does not make any difference


It might not have a performance uptick for the variables, but it will have a performance uptick for making methods final, as it increases the likelihood the JVM will inline/JIT the method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜