Just to clarify I was talking about inline functions, which to my knowledge, insert the code as would a macro. I realize that inline keyword is only a suggestion to the compiler but lets be honest, if its a simple multiplication function or macro , it will be placed inline if you request it.
Originally posted by Sayeh
It has nothing to do with 'typeless functions'.
If you run your code through a preprocessor, you will find that macros get inserted directly into the code wherever they are called. No stack setup & teardown.
Everytime a function is called, stack setup and teardown has to be performed. That's why recursive functions get progressively slower the longer they run (every watch a recursive floodfill?).
Of course you can't replace every function with a macro-- NOR WOULD YOU WANT TO. But as with all things, there are spots where you definitely want to avoid wasting time on maintenance.
A perfect example is a multiply function (let's say you were using fixed notation and had to write a multiply function for it)-- over a period of 30 seconds of animation, using a code profiler, you might find that that function gets called 100,000,000 times!! I kid you not. As such, if you can shave just 1 clock-cycle off every pass-- look at the SAVINGS! That's what performance is all about.