xuyunhong / connectbot

Automatically exported from code.google.com/p/connectbot
Apache License 2.0
0 stars 0 forks source link

Performance improvement suggestion #658

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Dear developers,

I am studying ConnectBot using a static code checker. I found some potential 
slow operations in ConnectBot's UI thread.

Android documentation says this:

http://developer.android.com/training/articles/perf-anr.html

"Any method that runs in the UI thread should do as little work as possible on 
that thread. In particular, activities should do as little as possible in key 
life-cycle methods such as onCreate() and onResume(). Potentially long running 
operations such as network or database operations, or computationally expensive 
calculations such as resizing bitmaps should be done in a worker thread (e.g., 
via AsyncTask)."

I found the following event handler performing database queries and file IO:

org.connectbot.HostListActivity's onKey handler at line 218 (revision 
716cdaa4841d): database queries
org.connectbot.PubkeyListActivity's onItemClick() handler at line 156: database 
queries and file IO
org.connectbot.HostListActivity's onActivityResult(): database queries
org.connectbot.HostEditorActivity's onCreate() and onSharedPreferenceChanged() 
handlers: database queries
org.connectbot.PortForwardListActivity's onCreate() handler: database queries
org.connectbot.ConsoleActivity's onNewIntent() handler: database queries
org.connectbot.PubkeyListActivity's onCreate() and onActivityResult() handlers: 
database queries and file IO
org.connectbot.ColorsActivity's onCreate() handler: database queries

Do you think these slow operations will affect ConnectBot's performance (e.g., 
making GUI not smooth enough)? If yes, perhaps moving them to a separate thread 
can help make ConnectBot super smooth in user interaction. Looking forward to 
your reply and hope I can help improve ConnectBot.

Original issue reported on code.google.com by yepang...@gmail.com on 26 Jul 2013 at 1:13