N
N
Nikita Gavrikov2016-09-13 13:45:37
Python
Nikita Gavrikov, 2016-09-13 13:45:37

How long does a program run in Python?

I wrote a function that calculates something there! But I ran into a problem if the argument is large, then it's not clear how long it will be executed! I can't figure out what I need to do in Paycharm to see it!
Roughly speaking func(10) - runs instantly
func(100) - already with a slight delay
func(20000) - already costs 20 minutes and nothing. I want to know how long to wait. Or maybe it's pointless and you need to rewrite the whole code? Or maybe somewhere there is something like "until the end is left ..."

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
nirvimel, 2016-09-13
@nirvimel

Unless the algorithm itself provides for the function of informing about the progress of its own execution, then outside it is theoretically impossible to determine at what stage the solution of the problem is and even whether this problem will ever be solved at all.

A
Anton, 2016-09-13
@Gambetto

You should use a debugger.
https://www.jetbrains.com/help/pycharm/2016.1/debu...

E
Eugene, 2016-09-13
@Eugen_p

something like "until the end is left ..."

I doubt that there is.
Calculate the complexity of your algorithm and see the approximate execution time.

D
Denis, 2016-09-16
@Norkotik

And the function has nothing to do with reading / writing to a file?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question