Brian Granger wrote:
Robin,
People from various projects have been testing the PyOS_InputHook stuff in various settings. Overall, the results have been good. But, some users are reporting slow GUI responses, which this new stuff is used interactively. Here is the current hypothesis about what the performance issue is related to:
The chunkiness probably comes from the fact that inputhook_wx is called repeatedly.
And the frequency of those calls will play a big role in the responsiveness of the GUI. IOW, events will be processed (in short bursts) only as often as the input hook is called.
[...]
Do you have any ideas on how these issues can be addressed. Obviously, being able to monitor stdin in the event loop would help, but it sounds like that isn't possible yet.
Something that can be done today with 2.8 is to add the outer loop I mentioned in a previous message, controlled by a function that is polling the stdin for input-readiness. Then it will stay in the event loop until there is input available for the interactive interpreter and won't depend on the hook being called more than once and/or often.
···
--
Robin Dunn
Software Craftsman