[PyQt] Bug (and fix!): laggy interactive input on Windows
Chris Billington
chris.billington at monash.edu
Wed Oct 22 22:52:55 BST 2014
Experimented. 20 is OK, 50 has noticeable lag, for me. If the loop is
changed to a while loop with the condition at the start, instead of a do
loop with it and the end, this seems to decrease latency by about a factor
of two, in which case 40ms or so seems to be acceptable too. But it is not
clear to me whether it is required that exec() run at least once per call.
-Chris
[sent from a mobile device]
On 22 Oct 2014 17:40, "Phil Thompson" <phil at riverbankcomputing.com> wrote:
> 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
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20141022/490cc391/attachment.html>
More information about the PyQt
mailing list