
Le Sun, 15 Jul 2012 11:29:06 +0200, Klaim - Joël Lamotte <mjklaim@gmail.com> a écrit :
On Sat, Jul 14, 2012 at 9:17 PM, Julien Jorge <julien.jorge@gamned.org>wrote:
For the performance, I don't think they should be inlined. First, I have no measure to tell that there is a performance bottleneck in the use of the ease functions. Then, the functions are passed as an argument to the constructor of single_tweener. I don't see how the compiler could inline a function used this way.
I don't know what you mean exactly, but i'm not a specialist either and I didn't benchmark anything. By the way, you suggest that the library would not be header-only? Or you don't mind if it is asked to be?
I don't mind if it is asked to be header only, and actually a template implementation using the the vectorized approach suggested by Rhys Ulerich seems interesting. What I say however is that I do not see how the compiler can inline the function f() in the following situation (that represents how the ease functions are used): inline double f( double ) { // … } void g( boost::function<double (double)>& func ) { double t = /* … */; double d = func( t ); // … } int main() { g( &f ); } Since the address of f is used in the call to g, I suppose that the compiler cannot inline the call in g. Regards, Julien Jorge