V
V
Vladislav2014-06-09 15:59:28
Python
Vladislav, 2014-06-09 15:59:28

How to make a performance test of two versions of Python?

There are two scripts with the same logic, written in different versions of the interpreter.
How to compare their performance not "by eye", but with numbers like in timeit?
Yes, yes, you can run timeit in both interpreters, but where is the confidence that this will be an honest and objective "judging", that is, how to find out that these two timeit are the same?
What are your suggestions, gentlemen?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Tolik, 2014-06-09
@Hateman31

If you have Linux, it's as easy as shelling pears:
time python2.7 myprog.py
time python3.2 myprog.py

T
tutunak, 2014-06-09
@tutunak

time.time()
variable start assign a value at the beginning of the script to the
variable finish assign a value at the end of the script
subtract from finish start - get the execution time

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question