magmax/python-inquirer

Heavy CPU usage while waiting for input in PowerShell

H0R5E opened this issue · 5 comments

H0R5E commented

Hi,

I noticed that when python-inquirer is waiting for input it is using a lot of CPU (probably a whole CPU thread) while waiting for input. I took these screenshots below:

inquirer_wait

inquirer_cpu

The version I am running is:

inquirer 2.7.0 py_0 conda-forge

It's in a conda environment being run in PowerShell on Windows 10 Pro.

Is this expected behaviour? Is there anyway to make it less hungry?

Many thanks,

Mat

this comes from the underlying readchar libary which has a while: True loop in the windows implimentation. This is whats hogging all the CPU. (see magmax/python-readchar#42)

The new v4.0.0 fixes this but is only in pre-release right now. You can however test if it solves this issue if you want.

H0R5E commented

Sure, I'll give it a try.

than use this to update your readchar version:

pip install -U --pre readchar
H0R5E commented

low_cpu_usage

Solved! Looking forward to the full release.

closed with the latest readchar release