GMP on Pentium 2

delta trinity deltatrinity at
Tue Oct 21 13:36:54 CEST 2003

Hello Patrick

Well, this may be due to several things.  First, I assume that both 
processors are running at the same speed, as you can see the reseults are 
almost equals for the greater limbs count.

I don't think that it's correct to assume that the large limb-count produce 
faster results here as the difference is only marginal, and most probably 
attributed to diferrences between the two systems (environment, which tasks 
are running in background, ...).  But indeed, you could tell that it's 
faster for lower limb count.

First, we would have to see how much cache is present in both systems.  If 
the P2 have less L1/L2 cache than the athlon, this may be the cause indeed.  
If it's the case, it's a good demonstration that show the importance of 
optimizing critical code to fit inside the CPU cache :)


>From: Patrick Pelissier <Patrick.Pelissier at>
>To: gmp-discuss at
>Subject: GMP on Pentium 2
>Date: Tue, 21 Oct 2003 12:26:27 +0200
>I think I have found a strange thing in GMP for Pentium 2 (and maybe also 
>I have built GMP 4.1.2 with gcc 3.2.1 with host=athlon and host=pentium2, 
>and I build speed program in both case (speed-at and speed-p2).
>I test both programs on Pentium2, with :
>speed-at -s SIZE -C mpn_add_n
>Here are the results (with some antialiasing since speed programs is not 
>very precise):
>SIZE  | speed-p2 | speed-at
>500   | 3.80     | 2.81
>5000  | 8.4740   | 8.54
>50000 | 14.80    | 15
>500000| 21.6     | 21.5
>It seems that GMP for Athlon is faster in low and huge precision (due to 
>overhead and cache, I think).
>Of course, the results are not sure. This is just for information.
>  Patrick Pelissier
>gmp-discuss mailing list
>gmp-discuss at

Add MSN 8 Internet Software to your current Internet access and enjoy 
patented spam control and more.  Get two months FREE!

More information about the gmp-discuss mailing list