Description
Dear developers,
We are applying our performance diagnosis tool PerfProbe to debug the user-experienced latency for searching for songs by some keyword (see "Steps to reproduce" below) in the Tomahawk Android app and observe that sometimes the latency increase to around 5 seconds and to 15.8 seconds in the worst case (on average around 1 second in my setup). Through its system-wide profiling and tracing, PerfProbe discovers that the source of extra delay results from longer execution time in the system API method libcore/io/Posix.poll (for example, one invoked by org/tomahawk/libtomahawk/infosystem/hatchet/HatchetInfoPlugin.getParseConvert -> retrofit/client/OkClient.execute -> com/squareup/okhttp/Call.getResponse -> java/net/Socket.connect), possibly caused by longer waiting time for server-side web responses.
Through inspecting TomaHawk's logcat messages and source code, we find that exceptions are frequently thrown ("java.net.SocketTimeoutException: failed to connect to api.hatchet.is/144.76.89.227 (port 443) after 10000ms" and "java.lang.IllegalArgumentException: Path parameter "id" value must not be null."). We suspect that the UI update of SearchPagerFragment (defined in app/src/main/java/org/tomahawk/tomahawk_android/fragments/SearchPagerFragment.java) is dependent on the return of web responses (through its callback method onEventMainThread), while the web requests seem to fail all the time. As a result, the UI update time is also dependent on when the exceptions are thrown.
We hope our findings can be helpful for your problem debugging and fixing. Please confirm if they are consistent to the app implementation. We are also interested in helping fixing the performance of this interaction. Thank you very much for your attention and clarification!
Expected behavior
Consistent latency for displaying the search result
Actual behavior
Intermittently increase of delay for displaying the search result
Steps to reproduce
- Click Menu icon
- Click "CHARTS"
- Click Search icon
- Enter some words in the text box (e.g., mama)
- Click Search button on the key pad
Environment
Tomahawk version: 0.986_armeabi-v7a from Google Play
Android version: Android 4.4.4
Device: Nexus 4