-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Touch input causes big slowdown ( from get_keyboard_height ) - can use 12% to 30%+ of cpu before even passing to kivy #268
Comments
This bug is present on SGS3 - profiles in original post are from SGS3 may not be an issue on nexus4: http://chozabu.net/autopush/nexus4.profile but on nexus4 app apparantly runs much slower anyway - though I did not see for myself. also have not heard from tester if they were touching screen during nexus4 profile Bug is present on motoG: http://chozabu.net/autopush/motog.profile |
Update - the tester on the nexus4 said he was not touching the screen - perhaps for a second at the start. This means 12% usage on processing input when there is no input? on motog test where one finger is being moved most of the time, dispach_input and on_motion combined are using over 20% of the CPU time! |
More profiles looking at touch input from simple pong app rather than my game boardz here: kivy/kivy#2470 as the app is much simpler, the profiles are somewhat clearer |
Simply moving the lines: into the global context did not prevent the issue, though it may have reduced it. skipping the function get_keyboard_height corrects the issue, but is of course not a real solution. |
relevant PR here: #272 |
Thanks to kived I just found out the real reason for the slowdown on touch input, Checking for height inside the layout listener and sending the key to kivy only when there is a height different solve the issue of keyboard_height being triggered again and again. closed via 52e1861 |
Hooray! Nice one! |
This is the function in question https://github.com/kivy/python-for-android/blob/master/recipes/android/src/android/_android.pyx#L174
profile of moving 1 finger for most of the time while profiling: http://chozabu.net/autopush/boardz-android-12-09-14-2135.profile ~12% total cpu usage by get_keyboard_height
profile of moving ~5 fingers for most of the time while profiling: http://chozabu.net/autopush/5fingers.profile ~30% total cpu usage by get_keyboard_height
It looks like eventes are issued by android when the keyboard changes - this would be a good time to cache the keyboard height:
ref - http://stackoverflow.com/a/18992807/445831
The text was updated successfully, but these errors were encountered: