Marco Beri wrote:
http://www.enrico-franchi.org/2011/07/atkin-for-everyone-benchmark.html
Hai provato l'algoritmo di Fabrizio?
Si. E' sconvolgentemente veloce essendo pure python.
Comunque questo e' il mio eratostene (sono 5 righe):
% time python erat_matrix.py 100000000
(array([ 2, 3, 5, ..., 99999959, 99999971, 99999989]),)
python erat_matrix.py 100000000 6.05s user 0.87s system 65% cpu 10.586
total
Sulla mia macchina:
% time python -c "import km;km.sieve(100000000)"
python -c "import km;km.sieve(100000000)" 9.10s user 0.21s system 97%
cpu 9.580 total
Adesso vedo se riesco ad aggiungerci una qualche micro-ottimizzazione
(al mio).
--
.
..: -enrico-
_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python