Recently we had a discussion at work about the impact of local variables on the performance vs readability of Java code. Some of my colleagues are of the oppinion that declarations like this
new DoSomethingCmd(new SelectionContext(context, keys), infoStuff.getCurrentRole().getRole_id()).execute(getResultContainer());
will give the application a considerable performance boost. They are willing to sacrifice code readability for this. Are they right in claiming this? Is the above version significantly more performant than, say, this one?
final SelectionContext selectionContext = new SelectionContext(context, keys);
final String roleId = infoStuff.getCurrentRole().getRole_id();
final DeleteSomethingCmd deleteSomethingCmd = new DeleteSomethingCmd(selectionContext,roleId);
deleteSomethingCmd.execute(getResultContainer());
I realise that the first statement isn't all that difficult to grasp in and on itself, but the complexity adds up rather quickly when most of your code is structured like that.
Thank you for your input.