We perform diagnosis on a common user interaction on iNaturalist app. Performance monitoring data show that the loading time for clicking "Guides" -> "ALL" tab is on average around 25 seconds and can increase to longer than 45 seconds. By analyzing app and OS-layer runtime traces, PerfProbe discovers that the source of extra delay results from longer delay in network blocking for object downloading during the execution of Android's API call libcore/io/Posix.recvfromBytes, which is invoked by get method calls inside getAllGuides method call in INaturalistService class. Based on our investigation of the source code, the getAllGuides method call is issuing sequential HTTP GET request for the link "guides.json?/per_page=200&page=x" page by page.
Based on these findings, we suggest limiting the number of results retrieved through HTTP GET request and add a "Load more" option in the UI for loading more results. We have implemented our suggested strategy by adding around 90 lines of code on existing code base and validated its improvement of the UI responsiveness. This fix consistently ensures loading time not more than 6 seconds and reduces the worst-case loading time by a factor of 8 (i.e., 8X speedup). We have issued a pull request for our implementation and are working with its developer to integrate our implementation for future app release.
[Update] The iNaturalist developer finally adopts parts of our suggestion: to simplify implementation, just show the first page of results (i.e., first 200 items) for the "All guides" tab without looping for sequential HTTP GET requests (and no need to add a "Load more" option in the UI). The commit log shows that the fix just requires removal of the looping logic.
Please view the details of our reported issue and communication with its developer at the GitHub issue tracker here