delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/10/14/09:51:34

Date: Wed, 14 Oct 1998 08:52:32 -0500
From: Eric Rudd <rudd AT cyberoptics DOT com>
Subject: Re: libc math function upgrade work
To: djgpp-workers AT delorie DOT com
Message-id: <3624AC9F.44717115@cyberoptics.com>
Organization: CyberOptics
MIME-version: 1.0
X-Mailer: Mozilla 4.05 [en] (Win95; U)
References: <Pine DOT SUN DOT 3 DOT 91 DOT 981014115810 DOT 8710E-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii wrote:

> Building the tests with -pg and looking at the cumulative time of the
> relevant math functions is the way to go, I think.
>
> In my view, it is important to know how much speedup does one gain by
> using this version as opposed to both libm and the current libc
> versions.  (I would expect to see a significant difference, at least
> relative to libm.)  Otherwise, the merits of getting current versions
> replaced are not clear enough.  IIRC, one of Eric's original goals for
> doing all this work was to gain speed, so this aspect seems to be
> important to Eric as well.

I made some systematic timings of my own on the new math routines I have been
working on, versus the libm.a routines.  These timings were made on an Intel
P200 MMX, Rhino 9 motherboard, IBM PC-DOS 6.3.  They were timed with a "rdtsc"
timer routine, and are the average of 1000000 calls for each function with
random arguments.

I observed about 10-20% variation on various compiles, probably due to code
alignment differences, but on the average the new routines are about three
times faster than libm.

I haven't done such extensive tests with the current libc, but when I was
developing my routines I did some individual tests, and my routines were no
more than 20% slower than the current libc.  This is mostly due to the extra
argument checking and changes to improve accuracy.

             Rudd library      libm.a

acos  time =  207 clocks    1357 clocks
acosh time =  262 clocks     573 clocks
asin  time =  212 clocks    1357 clocks
asinh time =  252 clocks     334 clocks
atan  time =  131 clocks     156 clocks
atan2 time =  157 clocks     408 clocks
atanh time =  200 clocks     413 clocks
ceil  time =   56 clocks      61 clocks
cos   time =   99 clocks     176 clocks
cosh  time =  198 clocks     369 clocks
exp   time =  139 clocks     364 clocks
expm1 time =  176 clocks     171 clocks
fabs  time =   17 clocks      46 clocks
floor time =   55 clocks      60 clocks
fmod  time =   66 clocks     208 clocks
hypot time =  103 clocks    1352 clocks
log   time =  121 clocks     254 clocks
log10 time =  121 clocks     376 clocks
log1p time =  130 clocks     189 clocks
log2  time =  120 clocks     120 clocks
pow   time =  255 clocks     684 clocks
pow10 time =  140 clocks     140 clocks
pow2  time =  132 clocks     132 clocks
sin   time =   99 clocks     174 clocks
sinh  time =  234 clocks     316 clocks
sqrt  time =   84 clocks    1229 clocks
tan   time =  148 clocks     286 clocks
tanh  time =  222 clocks     286 clocks

-Eric Rudd

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019