owncloud / owncloud/android

[TECHNICAL] Improve performance in main-thread operations

Open
#4,775 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Research Technical
Dominant language
Kotlin
Stars
4.2k
Forks
3.1k
Avg merge
1d 12h
Merged PRs (30d)
7

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate ReceiveExternalFilesActivity.onCreate(), prepareStreamsToUpload(), FolderPickerActivity.onCreate(), initAndShowListOfFilesFragment(), and FileDataStorageManager.getFileByPath(). Trace the file-system and SQLite work from those entry points and check whether the project has tests or guidance for main-thread operations. The issue needs a maintainer decision on scope before completion can be defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.