Reputation: 22270
I have seen time-sensitive backtracking programs written this way and I guess it makes the compiler avoid some memory copy and make a faster method call, and I guess this is useful on recursive programs.
But this is speculation by me, I'd like a detailed explanation/article on this or a refutation.
Upvotes: 2
Views: 938
Reputation: 3710
It has zero impact on performance - indeed, it has no runtime effect at all.
If you compile a class that contains 2 methods - one with the parameters marked as final, and the other without - and then look at the bytecode that gets generated for each method, you'll note that there is no difference (other than the method name).
All the final keyword does in this context is make it so that you cannot reassign that variable within the method.
Upvotes: 1