Closed evoggy closed 10 years ago
Changed timing for automatic input device discovery. Closes #41.
→ <
Original Comment By: Marcus Eliasson
I did the change you suggested. It lowered CPU usage for me from ~95% to ~20%.
Original Comment By: Allyn Bauer
I can't see this issue on Linux. The __do_devicediscovery is called each 10ms by _self._discoverytimer. But this call will result in the pygame.joystick sub-system being de-initialized and initialized again to detect if an input-device has been inserted or not (see #3).
The 10ms interval is a bit unnecessarily aggressive, it would be enough with 1000ms. Would it be possible for you to test if this "fixes" the problem on OSX? Just change line 139 in input.py from 10 to 1000.
Original Comment By: Marcus Eliasson
This seems to occur because _do_device_discovery is run continuously until a pygame Joystick is discovered. I see no path to fixing this problem without changing the paradigm of input device discovery. Requiring the user to tell the client to poll for input devices might make sense.
Does this not occur on windows or linux? It would seem that it must, unless I have misinterpreted the results of my profiling.
Original Comment By: Allyn Bauer
The client uses 100% CPU when the joystick is not connected. This issue seems to go away once the joystick is connected.
This was reported in the forum here