3 ms·
in other cases I prefer the whole algorithm to be in a single function A modern compiler can inline most of your function calls if you like. That way you can
by couchand 12y ago
in other cases I prefer the whole algorithm to be in a single function
A modern compiler can inline most of your function calls if you like. That way you can factor the code appropriately for both concerns.
- josephlord 12y agoPutting the whole algorithm in a single function isn't for the compiler's benefit but for the reader's. Especially in languages with side effects any function call you need to analyse takes time and then you need to come back to the main function and remember your mental state. Please note that in many cases putting an algorithm in a single function is the wrong choice but there is also a cost in splitting it.