Surrerstry.pl

Entries Projects About

 Performance tests of Python

11 November 2017

I made performance tests of Python depending on which OS we use Python.
Script tests efficiency of some common basic operations in Python.
I have to admit that following results surprised me a little bit.
On each system I used Python 3.5.

All results are in seconds
Test Case
Debian 9 Stretch
FreeBSD 11
Windows Server 2012 R2
1. Printing(send to null) 0.049 | 0.395 | 4.002 0.082 | 0.825 | 8.269 0.557 | 5.548 | 55.734
2. For loop 0.051 | 0.519 | 5.156 0.071 | 0.716 | 7.106 0.105 | 1.092 | 10.779
3. append to list 0.090 | 0.812 | 8.304 0.190 | 1.515 | 14.472 0.201 | 1.475 | 14.902
4. remove from list 2.520 | 13.612 | 33.020 2.737 | 10.943 | 24.143 1.364 | 13.904 | 39.606
5. Fibonacci number 0.268 | 3.965 | 15.757 0.283 | 4.510 | 18.354 0.260 | 3.713 | 14.528
6. Calling shell program 0.092 | 0.871 | 8.754 1.116 | 10.989 | 110.489 0.324 | 2.959 | 29.831
7. Write to file 0.454 | 4.538 | 22.688 0.066 | 0.867 | 4.708 0.130 | 1.464 | 7.252
8. Read from file 0.021 | 0.162 | 1.542 0.032 | 0.323 | 3.252 0.058 | 0.601 | 5.632
9. Creation and deleting big variable 0.587 | 5.760 | 57.983 0.690 | 6.163 | 60.489 0.625 | 7.361 | 75.192
10. Creating and removing instance of object 0.297 | 2.839 | 28.588 0.570 | 5.581 | 57.260 0.574 | 5.730 | 57.492
In total
225.59 358.77 361.36

I have run tests many times, results are repeatable.

There are 30 tests in total.

Debian 9 Stretch
FreeBSD 11
Windows Server 2012 R2
Wins 21 5 4
Loses 3 9 18
In the middle 6 16 8

In conclusion, we can see that Debian is definitely best in most cases, second is FreeBSD and on the end is Windows, though there is only a minimal difference between FreeBSD and Windows.

Source code:
Github Performance tests of Python
Onsite performance_tests.py.zip


Posts



Miscellaneous


Surrerstry.pl © 2014-2017-2018