Ilya Zakharevich on Fri, 26 May 2006 05:25:15 +0200


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

2.2.10 four times slower than 2.2.8


I'm testing the following code, and it is 4.5x slower with current
version than with an ancient.  The difference happened between 2.2.8
and 2.2.10.  I thought that new numeric integration code was quickier
than the old one...

    \r J:\test-programs\pari\bruijn.gp
    \p15
    5
    #
    bruijn_rho(5)
    \q

Here the file contains

\\ u rho'(u) = -rho(u-1), continuous for u>=0, 0 for u<0, u(0)=1
bruijn_rho(u) =
{
  local(n);
  if(u<0, return(0));
  if(u<=1, return(1));
  if(u<=2, return(1 - log(u)));
  if(u<=3, return(1 - log(u) + real(AA2(u))));
  \\ rho(sqrt(e)) = 1/2; thus half the numbers have prime divisors
  below 
  \\ n^(1/sqrt(e))
  n=ceil(u)-1;
  return(bruijn_rho(n) - intnum(X=n,u, bruijn_rho(X-1)/X));
  \\ if(u<=3, );
  error("not implemented yet")
}

\\ Calculation needs An(U)=INT{0 <= t1 <= t2 <= ... <= tn <= U} PROD dtK/(tK+K)
\\ n = ceil(u) - 1; U = u - n
\\ A2=INT{2,u} log(u-1)/u du = const(log(u)-log(2)) - dilog(u) + dilog(2).
\\ dilog(z) = - INT{0,z} log(1-z)/z dz

AA2(u)=-Pi*I*(log(u)-log(2))-dilog(u)+dilog(2)

Yours,
Ilya