discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AClock fork with republican time


From: Banlu Kemiyatorn
Subject: Re: AClock fork with republican time
Date: Thu, 23 Nov 2006 19:44:41 +0700
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Ingolf Jandt wrote:
I am absolutely not convinced. The amount of floating point instructions is about the same (yes, i have read the rest of the modf disassemble of my system). And a handful of MOVs on the stack are absolutely neglectible. 2. The code used sacrifices a lot of readability compared to "a/b", "modf (a/b,&dummy)" or even "a/b-floor(a/b)". Speed issues should only have precedence if there is no choice. 3. If speed did matter in any way the result would have been stored, not the computation code copied and pasted many times.

I put the code
    c=a-b*floor(a/b);c/=b;    or c=modf(a/b,&dummy);    or c=a/b;
    x=sin(2*M_PI*c);
    y=cos(2*M_PI*c);
into a loop and played with different inputs. It appears to me that
1. The calculation time of around 1,5(+-0,3)x10^-7 seconds is in each case ridicously short compared with the drawing period of ~ 10^-1 sec. 2. "Your code" takes -- depending on the input -- 5-20% _more_ time than "mine".
Leaving the mod-ing to the sin/cos functons saves again 10-15% of time.

All this applys of course only to my system. (Even if one could assume it for the majority of implementations comparing the speed of library functions is like debating about grains of sand whilst heavy rocks lie in writing a clean algorithm.)

So long
Ingolf


Wow, I have nothing to say except Thanks a lot!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]