I'm running a python program that's a fairly intensive test of many possible scenarios using a big-O of n algorithm. It's just brute-forcing it by testing over a billion different possibilities using at least five nested loops.
Anyway, I'm not concerned with how much time the program takes. It's fine to run in the background for long periods of time, it's just that I can't have it clogging up the CPU. Is there any way in Python (3.3) to devote less CPU to a program in exchange for giving it more time?
Thanks in advance.
A simpler solution might be to nice or re-nice your app. If you are running a Unix variant (Linux, *BSD, Mac), try something like this:
nice -n 19 python my_code.py
More info here: https://en.wikipedia.org/wiki/Nice_(Unix)
On Windows, you can try to set the priority via Task Manager (locate the Python process in Processes tab, right-click and select Set Priority).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With