Flickable performance - Hide items that are not in the visible area



  • Good evening,

    I am currently writing an application that displays animated images inside a Flickable, and I am curious about how I can optimize the scene in order to reduce the paint cost. For a low number of animated images, it is not a problem, but when I come with a lot of animated images (50 of them, 150x150px each, with a DropShadow/fast: true - I can't remove this effect, sadly) and drag the Flickable, I get bad results, between 8 and 18 FPS on my Android phone. I profiled in order to completely eliminate JavaScript costs during drags, so now, the remaining issue is the cost of the AnimatedImages during the movement animation of the Flickable.

    I have seen during my researches that it could be good to hide (visible: false) items that are not currently in the visible area of the Flickable, doing my own clipping (see https://www.youtube.com/watch?v=TiJiF0MOOFc at time 34:13 and after / QtDD14 - Using the QML profiler - Ulf Hermann). I used QSG_VISUALIZE=overdraw, and the result is that more than half of the images could in fact be hidden. My issue is that with something like the following, I get bad results because JS costs are too big:

    Flickable {
        // ...
        property int maxVisibleX: contentX + width
        property int maxVisibleY: contentY + height
    }
    

    Inside each AnimatedImage:

    visible: unit.x >= mapArea.contentX && unit.x < mapArea.maxVisibleX
        && unit.y >= mapArea.contentY && unit.y < mapArea.maxVisibleY
    

    The average time of each binding update is of 80usec, so for 50 images, it represents 4msec per update of contentX or contentY (when both are updated, it will probably represents 8msec):

    Profiling

    Without the JS hiding, when dragging (sorry for the French locale of the picture):

    Profiling_without_JS

    As you can see, the JavaScript clipping's benefit is lost because of the number of calls to it, leading to an equivalent result.

    So my question is the following: do you have any idea/comment that could help me increasing my FPS score? Any hint would be very appreciated!

    Thanks,
    Regards,
    Louis


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.