Final modifier applied to local variables - Java performance tuning
Joined: Aug 12, 2010
A few developers in my company have encountered websites that claim that using the final modifier on local variables creates a slight performance boost for a Java application. We are using WebSphere Portal 6.1 and WAS 7.0 and we use JSR 168/286 Portlets, EJB 3.0, Web Services, and Java 6. It's just that if the final modifier on local variables was truly a performance tuning tip I'm sure it would be general Java knowledge and would have been covered in the official SCJP book (Kathy & Bert). Using a final modifier should only be applied to a variable if a client with access to that variable has an opportunity to change the object it is referring to and this behavior is not desired.
Yesterday I posted this thread on the JSP forum and it appears to have been moved. This morning I was looking for this thread to see if anyone else had provided replies.
If anyone with expertise in this area can comment so I can share this finding with my peers it will be greatly appreciated.
SCJP 6, SCWCD 5
author and iconoclast
When a thread is moved on the Ranch, it just goes from one forum to some other, more you just click on it in the original forum, and you're automatically taken to the new location in the new forum. It's in "Java in General" now, and this link should take you there: