Checking performance of programs | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Checking performance of programs

What is a good way of checking the performance (running time, running space, etc) of programs? Whenever I use the timeit module for timing and comparing the runtime of two codes, there always seems to be a trend where the first code that is timed is slower than the rest or something like that. I’m not sure if I’m using it correctly. Here is an example. https://code.sololearn.com/czdIuUwupePb/?ref=app

18th Jan 2020, 7:51 PM
Zerokles
Zerokles - avatar
1 Answer
+ 2
When I ran your code a few times, I got very mixed results, the first test 'won' plenty.
18th Jan 2020, 7:54 PM
HonFu
HonFu - avatar