Putting 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.
A modern compiler can inline most of your function calls if you like. That way you can factor the code appropriately for both concerns.