New idea to increase seti speed

International discussions and queries, preferably in English. Deutsch wilkommen. Français bienvenu.

Moderátoři: zdespi, Moderátoři

Pravidla fóra
Příspěvky: 1
Registrován: pon úno 06, 2006 12:34 am
Bydliště: Beauvais - France

New idea to increase seti speed

Příspěvekod ThierryH » pon úno 06, 2006 1:02 am


I'm posting here on trux' invitation :)

I have a new idea to increase seti client speed. I've tested it on my MSVC++ but it's not an Intel... :wink:

So if someone wants to test...

Hans Dorn had the idea to cache sin/cos results. My idea is also to work on sin/cos functions, but by pre-calculated 10000 values in an array and extract results from this array.

In main.cpp, add this following lines in global variables field:

[code]float cosTable[10240];
float sinTable[10240];[/code]

In analyzeFuncs.cpp, just at the end of local variables:

[code] int i;
float j;

for (i=0 ; i<10240 ; i++) {
j = (float)0.00030679616 * (float)i; // 0.00030679616 is PI/10240
cosTable[i] = cos(j);
sinTable[i] = sin(j);

In sincos.h, replace sin and cos calculation by:

[code] angle /= (float)3.141593; // PI
if (angle >= 0) {
angle -= int(angle);
angle = angle * 10240.0 + 0.5;
*s = sinTable[(int)angle];
*c = cosTable[(int)angle];
} else {
angle *= -1.0;
angle -= int(angle);
angle = angle * 10240.0 + 0.5;
*s = -sinTable[(int)angle];
*c = cosTable[(int)angle];

I really think this methode could increase speed because it's requesting less memory than caching methode and save processor cache for calculation.

The number of 10240 values could be adjust by tests.

Uživatelský avatar
Banánová odměna
Banánová odměna
Příspěvky: 874
Registrován: čtv kvě 12, 2005 2:16 am
Kontaktovat uživatele:

Příspěvekod trux » pon úno 06, 2006 1:27 am

Hi Thierry,

Welcome in our Forum and thanks for sharing your idea with us! Currenlty I stopped the work on S@H app, since I spend a lot of time with the core client, but plan to play with the Enhanced client as soon as I complete the functions I started in the core. I can then certainly try implementing your idea and comparing it with the one already present. Afaik, there is also a caching mechanism already present (made by Tetsuji) in the Enhanced client, although it may be done differently than the one in the version from Hans Dron / Harold Naparst - I did not study the source code yet. I'd try it in the current version too, but have accidentally trashed my build dir with all the later modifications I did, and did not bother restoring it, because in the meantime Crunch3r came with a stabler version. If I find some time in the next days, I'll try to restore it, and will test your proposal. Thanks!

Zpět na „International“

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 1 host