zhanghai / MaterialFiles

Material Design file manager for Android
https://play.google.com/store/apps/details?id=me.zhanghai.android.files
GNU General Public License v3.0
6.16k stars 415 forks source link

Text editor has terrible performance with larger files since 1.4.0 #713

Open Markus40 opened 2 years ago

Markus40 commented 2 years ago

Larger files of about 200kB have pretty poor performance when writing. There is a big delay and new symbols appear only after a few seconds. The number of automatic line breaks also seem to affect the performance.

zhanghai commented 2 years ago

I can't reproduce this on an Android 12 emulator with the full text of the book 1984 - it was still pretty smooth for me to open and edit.

Markus40 commented 2 years ago

It doesn't seem to be an Android 12 problem, but maybe a Samsung problem. My main phone is a Samsung galaxy a52 5g. I tried it on a Samsung Galaxy S8 (with Android 9) and experienced the same problem. Smooth typing with version 1.3.1 and a lot of lag with 1.4.0.

The problem did not occur with the new version of the app on an old Xperia z5 compact, but I was unable to install the older versions and the phone is generally a bit slow.

I tried other keyboard apps but that didn't change the behaviour.

Markus40 commented 2 years ago

Here is a test file I used where the problem definitely occurs: https://we.tl/t-sGa8emoePZ

zhanghai commented 2 years ago

I don't think I changed anything related to the text editor between v1.3.0 and v1.4.0. The regression you saw about IME was due to the app raised its target SDK level and thus encountered a new OS behavior, and that has been fixed in v1.4.1. However I'm currently at a loss what could be the root cause for this one.

Markus40 commented 2 years ago

I have experimented a bit more and this problem is a little strange.

The file I have sent works fine on the Galaxy s8 with the old app version and has problems with the new version. It also has issues with the new version on the Galaxy a52 and I assumed it would work with the old app version but it doesn't. I tried it and the test file also has performance issues with the old app version on the galaxy a52. This means that the older and slower phone performs better with the old app version.

When I halve the test file, it no longer has problems on the new galaxy a52 (and of course no problems on the galaxy s8). With the new version, the problems persisted on both devices.

After a bit more experimentation with the old app version (on the galaxy a52), I found that there is a file size where the performance suddenly degrades. I don't think the performance issues in both versions are related as they manifest in different ways. In the old version there is a definite file size at which performance goes from good to bad. In the new version it is gradual and the performance slowly decreases as the file size increases.