Skip to content

[TECHNICAL] Improve performance in main-thread operationsΒ #4775

@nbd-boss

Description

@nbd-boss

Dear developers,

I am analyzing owncloud using a static code checker. I found some potential slow operations in owncloud'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(). 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've identified the following operations running on the UI thread that may cause performance issues:

  1. File system I/O:
    ReceiveExternalFilesActivity.onCreate() synchronously invokes prepareStreamsToUpload(), which performs blocking file system operations (e.g., calling File.getCanonicalPath()).
  2. Database I/O:
    FolderPickerActivity.onCreate() synchronously invokes initAndShowListOfFilesFragment(), which triggers disk I/O by querying the local SQLite database via FileDataStorageManager.getFileByPath().

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions