Matrix class slower than GL?

Started by
10 comments, last by Puzzler183 20 years, 1 month ago
Here is the source:
#include <iostream>#include <stdlib.h>#include <windows.h>#include <math.h>int main(){    using namespace std;    int time, dt;    float f;    float a = 31.142;    time = GetTickCount();    for (register int i = 0; i < 10000000; ++ i)    {    }    dt = GetTickCount() - time;    cout << "None: " << (float) dt / 10000 << endl;    time = GetTickCount();    for (register int i = 0; i < 10000000; ++ i)    {        f = sin(a);    }    dt = GetTickCount() - time;    cout << "Sin: " << (float) dt / 10000 << endl;    time = GetTickCount();    for (register int i = 0; i < 10000000; ++ i)    {        f = cos(a);    }    dt = GetTickCount() - time;    cout << "Cos: " << (float) dt / 10000 << endl;    system("pause");}


And then the linky:
clicky
Advertisement
that wont work. you should use optimized builds to see how fast it can get and that means the compiler will just throw away the loop (after all, whats the point in 10 million sin if the result is never used? and if it is, why not just calculate it once?)..

also: afaik gettickcount has less than ms precision and some overhead. with 10million calculations that probably wouldnt matter, but optimizations might make the result worthless (and for example sqrt seems to perform a lot better in optimized builds.. even fast enough so i couldnt find a decent replacement, as even interpolated table lookups weren''t really faster).
f@dzhttp://festini.device-zero.de

This topic is closed to new replies.

Advertisement