Merge lp:~adamreichold/qpdfview/track-exposed-tiles into lp:qpdfview
Status: | Merged |
---|---|
Merged at revision: | 1858 |
Proposed branch: | lp:~adamreichold/qpdfview/track-exposed-tiles |
Merge into: | lp:qpdfview |
Diff against target: |
74 lines (+20/-4) 2 files modified
sources/pageitem.cpp (+18/-4) sources/pageitem.h (+2/-0) |
To merge this branch: | bzr merge lp:~adamreichold/qpdfview/track-exposed-tiles |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Razi Alavizadeh | Pending | ||
Review via email: mp+248199@code.launchpad.net |
Description of the change
After noticing that the interface begins to "stutter" using high scale factors (roughly above 1000%) and isolating this to using tiling and continuous layout, I noticed during profiling that cancellation has a pretty large overhead. This was somewhat reduced by making sure that the atomic operations to set cancellation were inlined, but even then the atomic operations to cancel and to reset instances of "QPixmap" are still noticable.
It seems the main cause of this is the document view calling "PageItem:
This branch tries to alleviate the issue by making the page item explicitly track the exposed tiles and letting the document view cancel only those (for non-force cancellation, i.e. without interrupting prefetching which in itself is a problem with a high tile count) that were actually exposed. The page item itself will also cancel tiles when and only when they are removed from the set of exposed tiles which again reduces the number of pointless cancellation attempts.
The necessary changes are pretty limited, but as they touch a very fundamental function of the program, I would be grateful for a review and test by another developer.
Maybe we should also consider making "TileItem: :cancelRender" inline since even after these optimizations, it shows up on top of gprof's list. I strongly dislike this since it exposes the "RenderTask" internals of "TileItem", but then again "tileitem.h" (and hence indirectly "rendertask.h") are included into "tileitem.cpp" and "pageitem.cpp" only.
It seems like a sensible and pratically free optimization, but it also does not seem to noticeably reduce the "stutter" in any way, so I am very much unsure about it.