GNOME Bugzilla – Bug 780210
Thumbnailer gets the size of every page on startup
Last modified: 2017-03-26 15:47:42 UTC
Despite needing only the first page, the ev_document_load() gets the page size for *every* page in the document. This is not very expensive for cbz, but it all adds up: ** Message: comics_document_get_page_size took 0.004468 secs ** Message: comics_document_get_page_size took 0.005365 secs (and that for the 600 pages of the "From Hell" comic book) That's about 3 seconds getting data we won't use. Short-circuiting the calls for everything but the first page means that the thumbnailing (with libarchive backend) goes from 2.5 seconds to less than a tenth of a second.
+ Trace 237276
Hi Bastien, is it a rule that comics documents have the same page size for all pages?
No, but why would the thumbnailer get the page sizes for *all* the pages when it's only going to use the first one?
Oh... my bad... I was thinking on Thumbnail sidebar instead of thumbnailer...
Created attachment 348338 [details] [review] libdocument: Add "don't load cache" load flag
Created attachment 348339 [details] [review] libdocument: Allow passing flags to load functions
Created attachment 348340 [details] [review] FIXME: thumbnailer: Speed up thumbnailing By not loading the page cache for all the pages, but only the first one.
Comment on attachment 348340 [details] [review] FIXME: thumbnailer: Speed up thumbnailing This should instead do what's in ev_document_setup_cache() when there's no cache setup for the page and we're calling ev_document_get_page_size(). But I don't know how we'd handle the "uniform" parameter to EvDocument. This is an easy optimisation though, going from around 4.7 seconds to 1.25 seconds thumbnailing the "From Hell" comic (nearly 600 pages) using the libarchive backend.
Comment on attachment 348338 [details] [review] libdocument: Add "don't load cache" load flag I've pushed this and a follow up to load the cache ondemand only when needed for things like getting max/min sizes, uniform etc.
Comment on attachment 348339 [details] [review] libdocument: Allow passing flags to load functions Pushed.
Comment on attachment 348340 [details] [review] FIXME: thumbnailer: Speed up thumbnailing I've pushed this without the change in the comics backend, because I don't understand it, and I'm not sure it's needed.
So, I've done some tests and the cache is never loaded when using the thumbnailer now. Please, tests it and reopen this if there are still problems.
(In reply to Carlos Garcia Campos from comment #10) > Comment on attachment 348340 [details] [review] [review] > FIXME: thumbnailer: Speed up thumbnailing > > I've pushed this without the change in the comics backend, because I don't > understand it, and I'm not sure it's needed. The comics backend change was a hack, it would try to load only one page instead of all of them, to work-around the cache population hitting every page. It wasn't needed once you added the on-demand caching.