foobnix / LibreraReader

Book Reader for Android
http://librera.mobi
Other
2.82k stars 303 forks source link

[bug] long render lag time on DJVU fast page turns #1149

Open d3rpd3rpd3rp opened 12 months ago

d3rpd3rpd3rp commented 12 months ago

Hello,

I'm a former EBookDroid user who recently discovered Librera, and love it. I discovered a bug in the Librera Version 8.9.20 that appears to affect DJVU files specifically. When quickly turning pages (fast swiping ahead to the next 3 or more pages) in Book Mode, there is a considerable lag (3-5 seconds) before that page appears/renders on the screen. EBookDroid on the other hand renders the same fast page turns instantaneously, no matter how many pages I swipe ahead. It's not a huge problem, but does become frustrating when wanting to quickly skip ahead/behind. I don't think my device is the problem, as it is fairly recent (Samsung Galaxy S8+ tablet) and fully updated. Hopefully the issue can be fixed, because I would like to remove EBookDroid for good and completely use Librera.

Thanks!

[Edit] Here is an example file that produces this lag.

chemicalcain commented 11 months ago

To confirm, this only seems to affect DJVU files?

Also, when you open settings from within a book and go to Advanced Settings, is "Animate page transition" checked or unchecked?

d3rpd3rpd3rp commented 11 months ago

Yes, the page render lag seems to only affect DJVU files, there is no noticeable lag time for PDFs. "Animate page transitions (scroll)" setting is checked, which I believe is the default setting? The lag persists even after unchecking the setting.

d3rpd3rpd3rp commented 1 month ago

@foobnix So just a follow up from awhile ago, unfortunately the problem seems to persist into the latest Fdroid version of Librera (8.9.175). I can confirm that this behavior is not specifically a device problem, as I also experience it on other devices (for example, my old Moto G Power 2020 using a Snapdragon 665 chipset running Android 11). I observed that the issue seems to be CPU/memory dependent, as the lag is noticeably worse on the Moto than it was for the much more recent hardware in the Samsung S8 Galaxy Tab. Curiously, the last version of eBookDroid (2.7.4.1) experiences zero lag/delay (DJVU pages render instantaneously) after swiping ahead several pages. Here are some metrics that will hopefully assist with identifying the previously described lag/delay issue while quickly changing the pages from DJVU files.

To begin testing, I used a completely clean installation of Librera and EBookDroid (app data/cache/folder deleted) on my Moto phone, all settings used were default with two exceptions: in EBookDroid, after immediately starting the app I changed "All Settings->Book defaults->Document view mode" to "Single page", and in Librera I opened the DJVU using "Book mode"). From the first page of the DJVU file (using same file/book I referred to earlier), I then swiped forward 3 pages (to page 4) and measured the time in seconds with a stopwatch before the next page rendered on screen.

EBookDroid rendered the page instantly, each swipe forward resulting in a rendered page immediately, with the only delay being the speed of my swipes/page turns). However, Librera took 14 seconds (!!) for page 4 to render. There clearly is a lag/delay issue that is present in Librera that does not exist in EBookDroid for DJVU files. Fortunately, the developer of EBookDroid made the app source code available, and I found a link to the implementation of DjVuLibre that it uses. I'm not a programmer unfortunately, so I won't be able to help much by looking at the code myself, but I will try helping to test any changes that are made in the app itself.

Thanks again for all the great work!