<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, "Phil Thompson" <<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> 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'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'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>