primorial(negative)

paul zimmermann Paul.Zimmermann at inria.fr
Thu Nov 19 11:40:19 UTC 2015


       Torbjörn,

> From: tg at gmplib.org (Torbjörn Granlund)
> Date: Fri, 13 Nov 2015 20:07:24 +0100
> 
> paul zimmermann <Paul.Zimmermann at inria.fr> writes:
> 
>   you can also consider the file utils/getprime.c from CADO-NFS:
>   
>   zimmerma at tarte:~/svn/cado-nfs/utils$ gcc -O3 -g -DMAIN getprime.c
>   zimmerma at tarte:~/svn/cado-nfs/utils$ time ./a.out 1000000000
>   pi(1000000000)=50847534
>   
>   real    0m2.572s
>   user    0m2.268s
>   sys     0m0.000s
>   
>   This is almost 1000 times faster than GMP.
>   
> 1000 times faster than mpz_nextprime, sure.  But that's not a very fair
> comparison as one is set up to generate many primes while the other is
> set up to generate one prime at a time.
> 
> Here is some new code:
> 
> $ gcc49 -std=c99 -O2 ehb3sieve.c && /usr/bin/time ./a.out 1000000000
> 0.55user 0.00system 0:00.55elapsed 99%CPU
> 
> Which is more than 4 times faster than CADO-NFS.  :-)

you didn't compare on the same machine, and didn't give your source file so
that people can reproduce your timings...

I just downloaded primesieve-5.5.0 from http://primesieve.org/ and on the
same machine as CADO-NFS:

zimmerma at tarte:/tmp/primesieve-5.5.0$ time ./primesieve  -t1 1000000000
Sieve size = 32 kilobytes
Threads    = 1
100%
Primes  : 50847534
Seconds : 0.232

real    0m0.249s
user    0m0.232s
sys     0m0.000s

This is thus about 10000 times faster than GMP.

Paul


More information about the gmp-discuss mailing list