Bill Allombert on Sun, 11 Jan 2004 13:16:18 +0100


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

Flx_sqr/sqri comparaison


Hello PARI-dev,

I have made some timing of Flx_sqr and sqri

Here the file:
---------------------
install(Flx_sqr,GL);
V=vectorsmall(4000,i,random(17));
N=random(2^128000);
{
  print (i,"\t: pol\t|\t int");
  for(i=1,16,
    N=random(2^(32*2^i));
    V=vectorsmall(2^i,i,random(17));
    gettime();
    for(j=1,2^(16-i),Flx_sqr(V,17));
    tpol=gettime();
    for(j=1,2^(16-i),sqr(N));
    tint=gettime();
    print (i,"\t: ",tpol,"\t|\t",tint);
    );
}
---------------------

Result with PARI kernel:

i       : pol   |       PARI |       GMP
1       : 120   |       80   |       90
2       : 80    |       50   |       60
3       : 80    |       40   |       40
4       : 90    |       30   |       60
5       : 130   |       60   |       70
6       : 190   |       110  |       110
7       : 300   |       140  |       150
8       : 460   |       210  |       280
9       : 700   |       320  |       370
10      : 1060  |       500  |       550
11      : 1620  |       750  |       800
12      : 2450  |       1130 |       1010
13      : 3690  |       1740 |       1030
14      : 5600  |       2580 |       1200
15      : 8420  |       3910 |       1290
16      : 12670 |       5890 |       1600

2 conclusions:
1) Flx_sqr is much slower than sqri
2) GMP is faster only over 2000 words which is much more than I was 
expecting.

I suspect 1) is because Flx_sqr make much more modulo operations than
what is required.

I suspect 2) is due to my test machine.

I have a plan to reuse GMP fast multiplication in Flx_sqr.

Cheers,
Bill.