1. The math implementation of streflop (sin, sqrt ...) is almost 20 times slower than the one from <cmath>
2. The math implementation of streflop is probably used almost everywhere in the enging because of:
Code: Select all
#include "lib/streflop/streflop.h"
using namespace streflop;
3. SyncedFloat3 doesn't use streflop (doesn't this mean its less synced than the unsynced one )
Because of this big difference in speed we should really consider using streflop only where necessary (and not in graphics, rendering etc.)
PS: I used the following for measuring speed:
Code: Select all
#include <iostream>
#include <SDL/SDL_timer.h>
#define STREFLOP_X87
#include "streflop.h"
#include <cmath>
using namespace streflop;
int main(int argc, char *argv[])
{
float dummy = 0.0f;
unsigned start = SDL_GetTicks();
for (unsigned i = 0; i < 40000000; ++i)
{
float test = 0.0f, test2 = 1.0f;
test = std::sin(test2);
test2 = std::sqrt(test);
float result = test * test2;
dummy += result;
}
unsigned end = SDL_GetTicks();
std::cout << "Time cmath: " << end - start << " Result: " << dummy << std::endl;
dummy = 0.0f;
start = SDL_GetTicks();
for (unsigned i = 0; i < 40000000; ++i)
{
float test = 0.0f, test2 = 1.0f;
test = streflop::sin(test2);
test2 = streflop::sqrt(test);
float result = test * test2;
dummy += result;
}
end = SDL_GetTicks();
std::cout << "Time streflop: " << end - start << " Result: " << dummy << std::endl;
return 0;
}
Code: Select all
Time cmath: 261 Result: 1.67772e+07
Time streflop: 6677 Result: 1.67772e+07