-
Notifications
You must be signed in to change notification settings - Fork 4
Performance enhancement #8
Description
We are working on a project called DiagDroid (http://www.cudroid.com/PersisDroid/) for detecting potential performance issues. Our tool could find performance degradation caused by improper usage of asynchronous executions.
We find that in some cases your app may suffer a long processing delay.
Case 1:
Related source code Class: LawListFragment function: onCreate
Circumstance The law list update is often quite slow.
Problem You have remarked "And parallel update the list from network", but use execute function of sectionDB and updater. execute function will execute the two task in sequential instead of in parallel.
Suggested modification use executeOnExecutor instead of execute function.
Case 2:
Related source code Class: HeadlineComposerAdapter Method: getHeadlinesRaw
Circumstance The request to RestClient sometimes takes very long.
Problem Improperly use third party library RestClient. Using RestClient.get method, the operation is time-costly. When the page switches, the previous law is not necessary to be downloaded and displayed. Therefore some network requests should be cancelled.
Suggested modification Invoke cancel operation of RestClient when necessary.