Python - faster | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python - faster

How can I run python faster ? I want to screenshot per 0.1 sec. However I only can do it per about 0.4 sec. The main problem is line [98-147] Can you help me to solve it ? Thank you very much for your help!!! The code⬇️⬇️⬇️ https://code.sololearn.com/cmo68ZkWq62q/?ref=app

14th Jan 2020, 4:23 AM
Ethan
Ethan - avatar
3 Answers
+ 4
We need more info, all we know is that you're doing a bunch of clicks on some unknown program to take screenshots maybe, and nothing else. How do you take screentshots ? What are you taking a screenshot of ? Also, what are the other imports for ? And what is their purpose for taking a screenshot ?
14th Jan 2020, 4:32 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
You are using lots of library functions, without having much understanding about how they work. Check their documentation to see how they can be better configured to your needs. One way to improve speed is reduce the built-in pause that pyautogui is applying between clicks by default :) pyautogui.PAUSE = 0.01 https://stackoverflow.com/questions/35805649/how-to-increase-number-of-clicks-per-second-with-pyautogui Learn to use google, most of the answers are already there :)
14th Jan 2020, 5:47 AM
Tibor Santa
Tibor Santa - avatar
+ 3
Ethan What GPU is this running on? Also, this article might be helpful on understanding how to improve fps capture. https://towardsdatascience.com/bot-realtime-object-detection-in-overwatch-on-ubuntu-18-04-5571c4c85ec6
14th Jan 2020, 6:34 AM
David Carroll
David Carroll - avatar