开发者

Final for function parameter optimization

开发者 https://www.devze.com 2023-02-21 13:24 出处:网络
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 t

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

精彩评论

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