Splitting up functions, into smaller sub function into the code, can effect efficiency of the program?
while reducing cyclomatic complexity of functions i have break down function into smaller parts, and has used helper function and inline functions for it.
void functionParent(arguments)
{
intialCheckFunction(arguments);
functionOne();
functionTwo();
functionThree();
functionFour();
return STATUS;
}
void functionOne()
{
/*follows unary Principle.*/
}
My concern is regarding the stack pointer, does a frequent switch of SP reduce efficiency of program drastically or it negligible.
The above functionOne,Two,.. are having UNARY Logic in them.
Kindenter code herely reply in both context, C as well C++
Generally I prefer to break up function into smaller functions so that we can reuse it in other places, It is often required during re-factoring. If you are so concerned about the switch and if the function is really small you can mark it as inline. However i don’t think having too many functions make such a huge difference in performance of your program.