[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Bug (and fix!): laggy interactive input on Windows
From:       Chris Billington <chris.billington () monash ! edu>
Date:       2014-10-22 21:52:55
Message-ID: CAKy3cVtmvDS3hVEAYsycHSpvUG=9m-0D+TfOJSGUVjY-Gd5eQQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@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@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[Attachment #5 (text/html)]

<p dir="ltr">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.</p> <p dir="ltr">-Chris</p>
<p dir="ltr">[sent from a mobile device]</p>
<div class="gmail_quote">On 22 Oct 2014 17:40, &quot;Phil Thompson&quot; &lt;<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>&gt; \
wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">On 22/10/2014 6:51 pm, Chris \
Billington wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"> To whom it may concern,<br>
<br>
The input hook function qtcore_input_hook() in<br>
sip/QtCore/qcoreapplication.<u></u>sip appears to be the cause of laggy<br>
interactive input on Windows my colleagues and I been seeing. This mostly<br>
comes up when using matplotlib interactively with the PyQt backend (default<br>
in popular Windows Python distributions) - input keystrokes lag behind by<br>
some significant fraction of a second, making things pretty unusable.<br>
<br>
If one reduces the timeout in qtcore_input_hook()from 100ms to 10ms, the<br>
lag becomes completely unnoticeable and input is responsive once more. This<br>
increases Python&#39;s idle CPU usage from 0.03% to 0.3% on my machine.<br>
<br>
Attached is a script that demonstrates this in Python, and patches for<br>
sip/QtCore/qcoreapplication.<u></u>sip to reduce the timeout (If I have given<br>
these patches in the wrong format I apologize - it is a single character<br>
deletion so maybe providing patches is silly anyway).<br>
<br>
This applies to both PyQt4 and PyQt5.<br>
</blockquote>
<br>
Did you experiment to find 10 as the best, or did you pick it at random and it \
happened to work?<br> <br>
I just don&#39;t want to reduce it any more than necessary.<br>
<br>
Thanks,<br>
Phil<br>
______________________________<u></u>_________________<br>
PyQt mailing list      <a href="mailto:PyQt@riverbankcomputing.com" \
target="_blank">PyQt@riverbankcomputing.com</a><br> <a \
href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.<u></u>com/mailman/listinfo/pyqt</a></blockquote></div>



[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic