I have multiple algorithms in python that solves the same problem. I would like to know which one is more efficient. How can I make create an environment that both algorithms will have the same amount of resources (so I can tell which one is faster). each algorithm can take days to finish, so if there is a way to do that and still work on the computer, that will be better.
Asked
Active
Viewed 285 times
0
-
Can you use a smaller problem size, so that the algorithms won't take so long to finish? – Karl Knechtel Mar 29 '20 at 20:38
1 Answers
0
Your best bet would be to theoretically calculate the Big O notation for all your algorithms.
You should check out what Big O is here if you don't know
Or you could check out this video YouTube video for Big O

Akshath Mahajan
- 248
- 2
- 11
-
I am aware of the big O notation, but that is in theory. Both algorithms have the same big O notation – Kenny Smith Mar 29 '20 at 20:34
-
I would've suggested you this https://stackoverflow.com/q/1557571/12309792 if you hadn't said that the algorithms may take up to a few days to execute completely. For you particular problem, the theoretical big o is definitely the best bet, it'll save you much time :) – Akshath Mahajan Mar 29 '20 at 20:35
-
Thanks for the response. But the problem with just measuring time is that I can not tell which algorithm is faster, because they can have different CPU time. I am looknig for a way that all of those environment variables are the same (GPU time, CPU time, RAM ...) – Kenny Smith Mar 29 '20 at 20:46
-
1Okay got you. Unfortunately I'm not aware of anything like that, except for I've heard you can find the time of a script on Ubuntu or some other os. I'm not sure about that. – Akshath Mahajan Mar 29 '20 at 20:49