[ create a new paste ] login | about

Link: http://codepad.org/aSzc0esT    [ raw code | fork ]

Plain Text, pasted on Aug 2:
bash-3.1$ python --version
Python 2.7.6

bash-3.1$ cat test-gmpy2.py
from gmpy2 import next_prime

n = 0
while n < 1e7:
  n = next_prime(n)

bash-3.1$ time python test-gmpy2.py

real    0m4.766s
user    0m0.015s
sys     0m0.000s

bash-3.1$ pypy --version
Python 2.7.3 (87aa9de10f9c, Nov 24 2013, 17:46:53)
[PyPy 2.2.1 with MSC v.1500 32 bit]

bash-3.1$ cat test-my_math.py
from my_math import next_prime

n = 0
while n < 1e7:
  n = next_prime(n)

bash-3.1$ time pypy test-my_math.py

real    0m3.203s
user    0m0.015s
sys     0m0.000s

bash-3.1$ perl --version
This is perl 5, version 16, subversion 2 (v5.16.2) built for MSWin32-x86-multi-thread

Copyright 1987-2012, Larry Wall

bash-3.1$ cat test-prime_util.pl
use Math::Prime::Util qw(next_prime);

my $n = 0;
while($n < 1e7) {
  $n = next_prime($n);
}

bash-3.1$ time perl test-prime_util.pl

real    0m0.859s
user    0m0.015s
sys     0m0.000s



Create a new paste based on this one


Comments: