Hey all,
I'm just wondering about the amount of overhead a function incurs?
More specifically, I'm writing some 3D related code that makes use of several functions which perform very basic operations on vectors (3D vectors, not the C++ templates) which are basically just an array of 3 floats.
One such function would be adding two vectors, ie.
Since these operations will be carried out a great deal, I'm wondering if anyone has any insights on the overhead incurred by using a function, as opposed to a macro for this.Code:void addVect(float *dst, float *v1, float *v2) { dst[0] = v1[0] + v2[0]; dst[1] = v1[1] + v2[1]; dst[2] = v1[2] + v2[2]; }
I plan on doing some benchmarks to find out anyway, but I wouldn't mind knowing some more about what's going on, and why.