method invocation optimization