wordpress-mobile / wordpress-mobile/WordPress-Android

When browsing the same blog repeatedly, the same images are decoded repeatedly

Open
#14,392 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

[Pri] Medium [Type] Enhancement Gutenberg Media Performance
Dominant language
Kotlin
Stars
3.2k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
69

Description

Tested on [device], Android [version], WPAndroid [version]

Mi Note 3, Android 8.0, 16.3

Hi,
I performed the following operations on WordPress,
step1: click “Posts” on the main page
step2: click “Edit” of the first post “abc"

image

step3: click “Back” button

image

step4: repeat step2 and step 3 several times.

For the first time I opened the post, the speed of displaying the images in the post was slow and I think it is normal and acceptable.
However, when I opened the same post repeatedly, I found that the speed of image displaying was not smooth and the below page would appear for a short time.

image

By hooking WordPress, I found that several big images (e.g., 828*1104 pixels) were repeated decoded when I opened the same post repeatedly.
Below are part of the repeated decoded images:

image

image

Below are the decoded image data in WordPress during app execution (obtained by hooking WordPress) :

image

Data description: “828,1104" is the width and height of an image.

Below is the stack trace obtained by calling Thread.currentThread().getStackTrace() after each of the above images was decoded (after the statement responsible for image decoding was executed):
(each line contains "class name", "method name", and "line number”)
android.graphics.BitmapFactory;decodeStream;-1 com.bumptech.glide.load.resource.bitmap.Downsampler;decodeStream;718 com.bumptech.glide.load.resource.bitmap.Downsampler;decodeFromWrappedStreams;366 com.bumptech.glide.load.resource.bitmap.Downsampler;decode;224 com.bumptech.glide.load.resource.bitmap.Downsampler;decode;173 com.bumptech.glide.load.resource.bitmap.ByteBufferBitmapDecoder;decode;31 com.bumptech.glide.load.resource.bitmap.ByteBufferBitmapDecoder;decode;14 com.bumptech.glide.load.engine.DecodePath;decodeResourceWithList;92 com.bumptech.glide.load.engine.DecodePath;decodeResource;70 com.bumptech.glide.load.engine.DecodePath;decode;59 com.bumptech.glide.load.engine.LoadPath;loadWithExceptionList;76 com.bumptech.glide.load.engine.LoadPath;load;57 com.bumptech.glide.load.engine.DecodeJob;runLoadPath;524 com.bumptech.glide.load.engine.DecodeJob;decodeFromFetcher;488 com.bumptech.glide.load.engine.DecodeJob;decodeFromData;474 com.bumptech.glide.load.engine.DecodeJob;decodeFromRetrievedData;426 com.bumptech.glide.load.engine.DecodeJob;onDataFetcherReady;390 com.bumptech.glide.load.engine.DataCacheGenerator;onDataReady;94 com.bumptech.glide.load.model.ByteBufferFileLoader$ByteBufferFetcher;loadData;70 com.bumptech.glide.load.engine.DataCacheGenerator;startNext;74 com.bumptech.glide.load.engine.DecodeJob;runGenerators;310 com.bumptech.glide.load.engine.DecodeJob;runWrapped;276 com.bumptech.glide.load.engine.DecodeJob;run;234 java.util.concurrent.ThreadPoolExecutor;runWorker;1162 java.util.concurrent.ThreadPoolExecutor$Worker;run;636 java.lang.Thread;run;764 com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1;run;431

Repeated decoding of the same images will take a lot of unnecessary time consumption, which would be the reason why image displaying is not smooth in WordPress.

I noticed that Glide is applied in WordPress. Maybe be the usage of Glide should be further optimized to cache these repeated decoded images in memory.

Thanks.

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

Reproduce the repeated post open-and-back flow described in the issue, then inspect the Glide entry points named in the stack trace, including Downsampler and DecodeJob. Confirm whether the same images are decoded again and determine what cache behavior would prevent that; done means repeated opens no longer cause redundant decoding or visibly uneven image display.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.