Forums

How to reduce CPU time usage

I have an always-on task that runs 24/24 and it is taking up most of my allocated CPU time. Is there any optmisation I can do to my script in order to reduce CPU time?

I'm not an experienced Python developer so any advice would be much appreciated.

Unfortunately there's no simple general trick to make your code use less CPU -- it depends very much on what your code is doing, and whether it's doing any unnecessary work.

I understand. Thanks Giles. I'm currently doing a lot of print to log, would this take CPU time?

Printing shouldn't use up any serious amount of CPU, no.