View Single Post
pycage's Avatar
Posts: 3,404 | Thanked: 4,474 times | Joined on Oct 2005 @ Germany
#177
Originally Posted by fms View Post
So, if there is anything that can slash the loading time, apply it by all means
I think I'm making some good progress there.
The next release should startup faster. But 7 seconds on the N8x0? Not even microB achieves this (just measured; 9 seconds).

Originally Posted by fms View Post
Once the scrollable list shows up, it looks to be filling up asynchronously. Only small part of the list (5-7 items) is shown at any moment of time. So, what part of rendering contributes to that delay?
As weird as it sounds, it's a full screen rendering because of changing the layout and the toolbar contents. I'm now trying to minimize the amount of rendering a bit further. Especially the toolbar stuff should be optimizable.

Originally Posted by fms View Post
I doubt that scrolling delays are directly caused by the thumbnail rendering (they may though, and then it is all up to the filesystem responsiveness). Instead, they may be caused by garbage collection or some other internal process in Python. If it is true, then it would be fixable by preallocating all memory for the list before scrolling it.
It's all preallocated in the list. The same offscreen pixmaps are used over and over again for rendering the items. When you scroll, this is what happens:

The screens contents are moved by the amount that you scroll (Xserver-side pixmap copying). Only the newly visible items get rendered. Every time a new item with a thumbnail gets rendered, the thumbnail has to be read from file. There is some thumbnail and item caching involved, too, for speeding up the process, but these caches can't hold many items.

The time consuming parts I see are thumbnail loading and maybe rendering the text. Have you checked the resolution of thumbnails? Maybe some are really big (due to a bug in an earlier version of MediaBox) and thus cause long loading. Text rendering can take some time when pango has to lookup new characters (e.g. for displaying CJK characters), but once the characters are loaded the delay won't happen again.
I have never seen garbage collection kick into action while scrolling.

It would be interesting to see what happens when you disable thumbnail loading and rendering by opening /usr/lib/mediabox/components/media_viewer/MediaItem.py and commenting out the line with
Code:
self.render_icon
.
Likewise you can try commenting out the other things such as
Code:
render_label
or
Code:
render_bg
(for the background of the item).