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

Performance improvement suggestions #196

Open
sunshinelwj opened this issue Nov 27, 2021 · 0 comments
Open

Performance improvement suggestions #196

sunshinelwj opened this issue Nov 27, 2021 · 0 comments

Comments

@sunshinelwj
Copy link

When loading images, Google suggests us to cache the bitmaps that can be reused, so as to keep a fluid and fast-loading UI.
https://developer.android.com/topic/performance/graphics/cache-bitmap.html

However, in the code below, bitmap caching is not applied:
de.k3b.android.androFotoFinder.imagedetail.HugeImageLoader.java loadImage()
https://github.com/k3b/APhotoManager/blob/FDroid/app/src/main/java/de/k3b/android/androFotoFinder/imagedetail/HugeImageLoader.java#L75

I found loadImage() is invoked directly by:
de.k3b.android.androFotoFinder.gallery.cursor.GalleryCursorAdapterFromArray.java getView()
https://github.com/k3b/APhotoManager/blob/FDroid/app/src/main/java/de/k3b/android/androFotoFinder/gallery/cursor/GalleryCursorAdapterFromArray.java#L99

getView() is a function that is frequently invoked, which means that there will be many duplicate bitmap objects being created if we not define a cache to store them.

For performance considerations, maybe we can define memory cache and disk memory cache to store the bitmap objects. Then app can reuse them instead of creating new bitmap objects continuously. In addition, since image decoding is slow, we can perform these operations in worker threads (e.g., via AsyncTask).

Thanks.

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