I had a performance issue when I was thinking about changing the style of the code. Previously, I liked everything to minimize, for it seemed like something to increase performance.
Example 1
new Run(path).start();
From the point of view of refactoring, it is better to write so:
Run run = new Run(path);
run.start();
So it's easier to read the code, but the question is, will I lose something because of this? Because the run
is placed in the RAM?
Example 2
The line from my project (yes, creepy):
tabPane.getTabs().get(i).setUserData(Paths.get(newFile.substring(0, indexOfDifference) + name + path.toString().substring(indexOfDifference + nameOfDifference.length(), path.toString().length())));
It is difficult to read this code to a person, I understand, but if I sign every step:
String firstHalf = newFile.substring(0, indexOfDifference);
String secondHalf = path.toString().substring(indexOfDifference + nameOfDifference.length());
Path path = Paths.get(firstHalf + name + secondHalf);
tabPane.getTabs().get(i).setUserData(path);
Will I lose significant performance?
P.S. Sorry if the topic was repeated, but did not know how to write a search query.