A frame of a thread stack is created when a method is called, and creating stack frames have negative effect to the performance of a java program. I want to know how much effect it is?
As I know, refactoring codes often leads to separating a method call into more than one method call, and I think it leads to increment method call count in the end. So, is it true that the ways of refactoring with separating method calls have negative effect to performance of java programs to be refactored?
For example:
Before refactored:
public class MyClassA {
public void doTask1(){
// here is very verbose code
}
}
After refactored:
public class MyClassA {
public void doTask1(){
taskPart1();
taskPart2();
taskPart3();
}
public void taskPart1(){
// do something that used to be in doTask1..
}
public void taskPart2(){
// do something that used to be in doTask1..
}
public void taskPart3(){
// do something that used to be in doTask1..
}
}