Skip to content
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

perf #583

Open
kangyu opened this issue Jul 3, 2015 · 0 comments
Open

perf #583

kangyu opened this issue Jul 3, 2015 · 0 comments

Comments

@kangyu
Copy link

kangyu commented Jul 3, 2015

We are working on a project called PersisDroid (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: LoadOPDSTask Method: doInBackground
Circumstance Sometimes the network condition is poor. The user may switch activity before the OPDSfeed is obtained. The operation of request the feed should be cancelled as soon as possible.
Problem Some network request AsyncTasks are already cancelled but they are not stop immediately. These tasks may consume unnecessary network resource.
Suggested modification Check one more time whether the task is cancelled after the second network request via isCancelled() method.

Case 2:
Related source code Class: ReadingFragment Method: sendProgressUpdateToServer
Circumstance The progress update sometimes delays too long to send to the server, which may cause the progress incorrect on next loading.
Problem All the background works share one handler (_backgroundHandler). The background tasks are posted on one handler which means they have to run sequentially if multiple tasks are invoked simultaneously.
_Suggested modification* Use a separate handler for progress updating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant