thorium-reader icon indicating copy to clipboard operation
thorium-reader copied to clipboard

Slow rendering on very large HTML resources in paginated mode

Open PhilippeBruno opened this issue 3 years ago • 6 comments

A recently published book, Le livre noir de ondes, that opens fine in Adobe Digital Editions, turns Thorium into an unresponsive app when opened. EPUB sent privately to Daniel Weck for debugging purposes.

PhilippeBruno avatar Jun 16 '21 13:06 PhilippeBruno

Thank you for sharing the EPUB privately. This publication contains a very long HTML document which displays fine in scrolling mode in Thorium, but rendering degrades significantly when in paginated mode. The performance flamegraph shows a huge amount of time spent painting: Screenshot 2021-06-16 at 15 09 59

danielweck avatar Jun 16 '21 14:06 danielweck

Yes, after emailing you the EPUB, I spent some time testing on my end, and I also noticed the very long HTML (it is actually the very first time I see something like this).

Thanks for pointing out about the "paginated" versus "scrolling" mode. I did not think of changing this display setting. It is definitely the type of book that needs to be read in this mode!

PhilippeBruno avatar Jun 16 '21 14:06 PhilippeBruno

But this still raises a question... Is there not some improvement that could be done to the display routines of Thorium to not spend time rendering something that is not visible when in paginated mode?

PhilippeBruno avatar Jun 16 '21 14:06 PhilippeBruno

Daniel and I discussed it briefly. The use of CSS column for pagination does not save CPU for invisible "pages", sadly. But Daniel will still check if the process is totally optimized, when he finds some time :-).

The baseline is still that we are here in front of bad authoring (I mean authoring which does not understand rendering issues in EPUB apps based on browser engines, what ADE is not).

llemeurfr avatar Jun 17 '21 17:06 llemeurfr

Bonjour Laurent, thank you for your input. It makes perfect sense. Let's hope Daniel will be able to find some time in the not too distant future... So far, he's been pretty amazing at solving weird issues, often caused by poor EPUB authoring or rare bugs!

PhilippeBruno avatar Jun 17 '21 17:06 PhilippeBruno

My plan is to attempt to reproduce the performance degradation using a reduced implementation of the pagination method used in Thorium to render HTML documents. In a nutshell: CSS Columns in a document hosted inside an Electron Webview which is itself embedded in an Electron BrowserWindow (in other words: this is an elimination process consisting removing the bulk of the additional Javascript event-based logic which drives the rendering / interaction logic)

danielweck avatar Jun 18 '21 16:06 danielweck

I believe this is fixed in Thorium 2.1.0, please re-open if not.

danielweck avatar Aug 26 '22 17:08 danielweck