Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does declaring things as final speed up Eclipse code analysis and compilation?

Tags:

java

eclipse

I was wondering if making code more explicit helps Eclipse to analyse it faster. For example, if I declare a class as final, the code analyser theoretically can skip searching for its descendants when computing type hierarchy.

So, does it really speed things up?

like image 583
Fixpoint Avatar asked Sep 05 '11 08:09

Fixpoint


1 Answers

It is possible that using final keyword could be taken advantage by a smart analysis tool, though I would imagine that analysis is done bottom-up in the class hierarchy because a superclass doesn't need to care about subclasses anyway.

However, using final DOES increase runtime performance somewhat due to certain compiler optimizations that are taken advantage of. This is micro-optimizing though; while it's a good practice to use final when appropriate, the performance increases will not be large compared to optimizing the architecture of the program.

like image 181
Jonathan Weatherhead Avatar answered Oct 29 '22 21:10

Jonathan Weatherhead