primorial(negative)
Torbjörn Granlund
tg at gmplib.org
Fri Nov 13 19:07:24 UTC 2015
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. :-)
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-discuss
mailing list