To optimize and maintain good performance, this sounds like a developer must limit how many functions are called.
Yes and no. Functions (or, more generally, subroutines) should be called, and it does not make sense to not do this. If you can make your code drier by introducing another function, do it.
The only place where they are not used is reasonable, these are high-performance loops that work thousands of times but do not work much, and function calls will add noticeable overhead. Do not try to optimize prematurely !
In addition, there are some languages ββthat handle recursion poorly and where you need to translate recursive function calls into loops, except for stackoverflow exceptions. However, this is also a rare case.
is it better to call one method after another or insert them?
It depends on how the two methods do different things. In # 1 there are only 3 independent functions called one after another. In contrast, # 2 defines functions that always call each other - you cannot get myFunc2 without myFunc3 . Is this intended?
If so, there is nothing wrong with this nest. Two additional stack layers will not hurt your performance.
Bergi source share