David Megginson writes:
>
> In my (limited) tests, even inlining something like
>
> void setFoo (double foo) { _foo = (foo < 0 ? 0 : foo); }
>
>slows things down.
Really ??
then try this both with and without optimization :-))
== cut ===
#include <iostream>
#include <time.h>
#define NUM_TESTS 100000000
double jnk = 0.0;
double make_junk( double a );
inline double test_junk( double a )
{
return (a-NUM_TESTS/2) < 0 ? 0 : 1;
}
int main(int argc, char **argv)
{
int i;
int start;
start = clock();
for( i=0; i<NUM_TESTS; i++)
{
jnk = make_junk(i);
}
cout << "elapsed " << clock() - start << endl;
start = clock();
for( i=0; i<NUM_TESTS; i++)
{
jnk = test_junk(i);
}
cout << "elapsed " << clock() - start << endl;
}
double make_junk( double a )
{
return (a-NUM_TESTS/2) < 0 ? 0 : 1;
}
_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel