Quick A: Possibly.
Recently on SO:
It can be.
An optimisation along these lines would relate to the "de-virtualization" of the virtual calls. This is not always immediately affected by the
finalof the class nor method. Albeit they offer help to determine this, the normal rules of the virtual functions and class hierarchy apply.
If the compiler can determine that at runtime a particular method will always be called (e.g. given the OP example, with an automatic object), it could apply such an optimisation anyway, irrespective of whether the method is
Optimisations fall under the as-if rule, that allow the compiler to apply any transformation so long as the observable behaviour is as-if the original code had been executed.