Python on windows - conhost.exe CPU usage
-
09-02-2021 - |
Pregunta
I'm running a Python script on Windows, and I've noticed that even though the Python process takes ~8% CPU, the associated conhost.exe
process takes ~14%.
Why is this so? How come such a large part of the CPU consumption is in the conhost and not in the Python process?
Is there a way to reduce this CPU consumption? (besides optimizing the code of course)
UPDATE 1: Win7 64bit, Python 2.6.6
UPDATE 2: The Python program uses a C++ package via SWIG Python bindings. The C++ package (quickfix) does I/O with the network quite a bit (1), it also prints to the console (2). The Python code prints to several files (3). Which if these three should be suspect?
Solución
Since we don't know what your program is doing we have to guess a little. So long as there is no I/O I'd expect conhost
to consume 0% CPU. So I hypothesise that you are printing a lot of text to the console. For example, the following program has the same symptoms as you report:
while True:
print "Hello world!"