Page 1 of 1

Python 3.7.3 and 2.7.16 speed tests for Buster

Posted: Wed Jun 26, 2019 7:02 pm
by hippy
Buster brings us Python 3.7.3 and 2.7.16 which both seem to give a general improvement over Python 3.5.3 and 2.7.13 installed by default under Stretch -

For a simple Fibonacci benchmark -

Code: Select all

def Fibonacci(n):
  if n <= 1 : return n
  else      : return Fibonacci(n-1) + Fibonacci(n-2)

print(Fibonacci(24))
Previous Stretch testing -

Code: Select all

        3.5.3     2.7.13    MicroPython v1.10-278

real    0m0.399s  0m0.290s  0m0.217s
user    0m0.397s  0m0.289s  0m0.217s
sys     0m0.001s  0m0.000s  0m0.000s
Same Pi 3B (non-plus) running Buster -

Code: Select all

        3.7.3     2.7.16

real    0m0.303s  0m0.221s
user    0m0.292s  0m0.221s
sys     0m0.011s  0m0.000s

For a simple increment benchmark -

Code: Select all

x = 0
for n in range(0,1000000):
  x = x + 1 
Previous Stretch testing -

Code: Select all

        3.5.3     2.7.13

real    0m1.293s  0m0.802s
user    0m1.110s  0m0.740s
sys     0m0.030s  0m0.060s
Same Pi 3B (non-plus) running Buster -

Code: Select all

        3.7.3     2.7.16

real    0m1.146s  0m0.884s
user    0m1.134s  0m0.852s
sys     0m0.012s  0m0.032s
These aren't particularly scientific or realistic benchmarks but they do compare like with like. As usual; performance will depend on the actual code being run.