Bill Allombert on Mon, 22 Oct 2012 19:50:34 +0200


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

GCC 4.7.0-11 reverse slowdown


Dear PARI developers,

I have spent the afternoon investigating a strange speedup with
GCC version 4.7.0-11:
The function I test is FpX_divrem in PARI 2.5.2 (with GMP 5.0.5).

The test is:
install(FpX_divrem,GGG)
p=nextprime(2^128);
P=random(p*x^20000);
Q=random(p*x^10000);
FpX_divrem(P,Q,p);
##
p=nextprime(2^1280);
P=random(p*x^10000);
Q=random(p*x^5000);
FpX_divrem(P,Q,p);
##

The result (this is the version of the Debian packages, that are a bit off 
with respect to upstream versions (4.7.0-12 is close to 4.7.1 upstream). 

As you see gcc 4.7.0-11 is nearly twice faster than all other versions.
(4.7.0-11 is gcc SVN r188035)
I do not have time to investigate any further but it would be interesting
to know what happen. With a bit of luck we could tweak the code to get
the speed up with other compilers too.

gcc/4.6.3-12/pari-2.5.2/gp
  ***   last result computed in 7,576 ms.
  ***   last result computed in 20,061 ms.
gcc/4.7.0-1/pari-2.5.2/gp
  ***   last result computed in 7,240 ms.
  ***   last result computed in 19,962 ms.
gcc/4.7.0-10/pari-2.5.2/gp
  ***   last result computed in 7,172 ms.
  ***   last result computed in 19,946 ms.
gcc/4.7.0-11/pari-2.5.2/gp
  ***   last result computed in 3,628 ms.
  ***   last result computed in 9,989 ms.
gcc/4.7.0-12/pari-2.5.2/gp
  ***   last result computed in 7,176 ms.
  ***   last result computed in 19,950 ms.
gcc/4.7.0-13/pari-2.5.2/gp
  ***   last result computed in 7,176 ms.
  ***   last result computed in 19,946 ms.
gcc/4.7.1-1/pari-2.5.2/gp
  ***   last result computed in 7,176 ms.
  ***   last result computed in 19,946 ms.
gcc/4.7.1-9/pari-2.5.2/gp
  ***   last result computed in 7,176 ms.
  ***   last result computed in 19,942 ms.
gcc/4.7.2-4/pari-2.5.2/gp
  ***   last result computed in 7,176 ms.
  ***   last result computed in 19,938 ms.

Acknowledgement: I like to thanks Debian snapshot.debian.org service for
providing old gcc Debian packages and the Debian gcc maintainers for making
them relocatable.

Cheers,
Bill.