[PyQt] Bug (and fix!): laggy interactive input on Windows
Phil Thompson
phil at riverbankcomputing.com
Wed Oct 22 22:40:02 BST 2014
On 22/10/2014 6:51 pm, Chris Billington wrote:
> To whom it may concern,
>
> The input hook function qtcore_input_hook() in
> sip/QtCore/qcoreapplication.sip appears to be the cause of laggy
> interactive input on Windows my colleagues and I been seeing. This
> mostly
> comes up when using matplotlib interactively with the PyQt backend
> (default
> in popular Windows Python distributions) - input keystrokes lag behind
> by
> some significant fraction of a second, making things pretty unusable.
>
> If one reduces the timeout in qtcore_input_hook()from 100ms to 10ms,
> the
> lag becomes completely unnoticeable and input is responsive once more.
> This
> increases Python's idle CPU usage from 0.03% to 0.3% on my machine.
>
> Attached is a script that demonstrates this in Python, and patches for
> sip/QtCore/qcoreapplication.sip to reduce the timeout (If I have given
> these patches in the wrong format I apologize - it is a single
> character
> deletion so maybe providing patches is silly anyway).
>
> This applies to both PyQt4 and PyQt5.
Did you experiment to find 10 as the best, or did you pick it at random
and it happened to work?
I just don't want to reduce it any more than necessary.
Thanks,
Phil
More information about the PyQt
mailing list