Note: For this question I will mainly be referring to C++, however this may apply to other languages.
Note: Please assume there is no recursion.
People often say (if you have an exceptionally large function) to “break up” a function into several smaller
functions, but is this logical? What if I know for a fact that I will never use one of those smaller functions,
that is just a waste of: memory, performance, and you may have to jump around the code more when reading it.
Also what if you are only going to use a (hypothetically large) function once, should you just insert the
function body into the place where it would be called (for the same reasons as last time i.e: memory, performance, and you may have to jump around the code more when reading it)? So… to make a function or not to make a function, that is the question.
TO ALL
*EDIT*
I am still going through all the answers, however from what I have read so far I have formed a hypothesis.
Would it be correct to say split it up functions during development, but do what I suggest in the question before deployment, along with making functions you use once in development, but inserting bodies before deployment?
This really depends on the context.
When we say the size of a function, we actually mean the semantic distance of lines inside the function. We prefer that one function should do only one thing. If your function only does one thing and semantic distance is small inside it, then it is OK to have large function.
However, it is not good practice to make a function do a lot of things and it is better to refactor such functions to a few smaller ones with good naming and good placement of codes, such that the user of the code does not need to jump around.