Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtQuick 2 animation performance issue



  • Consider example below:

    @
    import QtQuick 2.0

    PathView {
    width: 1280
    height: 720
    cacheItemCount: 7
    pathItemCount: 7
    preferredHighlightBegin: 0.5
    preferredHighlightEnd: 0.5
    model: ListModel {
    ListElement {
    color: "orange"
    text: "first"
    }
    ListElement {
    color: "lightgreen"
    text: "second"
    }
    ListElement {
    color: "orchid"
    text: "third"
    }
    ListElement {
    color: "tomato"
    text: "fourth"
    }
    ListElement {
    color: "skyblue"
    text: "fifth"
    }
    ListElement {
    color: "hotpink"
    text: "sixth"
    }
    ListElement {
    color: "darkseagreen"
    text: "seventh"
    }
    ListElement {
    color: "salmon"
    text: "eightth"
    }
    ListElement {
    color: "darkolivegreen"
    text: "nineth"
    }
    ListElement {
    color: "navy"
    text: "tenth"
    }
    }
    delegate: Item {
    width: 150
    height: 150

        Rectangle {
            id: rect
            anchors.fill: parent
            color: model.color
            opacity: 0.8
        }
    
        Text {
            anchors.centerIn: parent
            text: model.text
            color: "white"
            font.pixelSize: 24
        }
    }
    path: Path {
        startX: -150
        startY: height / 2
        PathLine {
            x: width + 150
            relativeY: 0
        }
    }
    
    NumberAnimation on offset {
        from: 0
        to: count
        loops: Animation.Infinite
        duration: 4000
        Component.onCompleted: start()
    }
    

    }
    @

    The animation is jerky for Qt versions 5.1.1 and 5.3.2 (Ubuntu 14.04), and 5.2.1 (embedded Linux). I guess, this is the garbage collector affecting performance, but since UI structure does not change such suggestion might be irrelevant. Is there anything can be done to make animation run smoothly?



  • Strange usage of "offset" property. From what I know should be used only for setting the initial configuration of the PathView.
    Try to animate the currentIndex property.



  • Interesting, I don't experience this issue on Mac OS X 10.10.



  • This seems smooth to my eyes in both Windows 7 and Kubuntu 14.10.

    Is the jerkyness very subtle? If not, can you check if any processes are possibly loading your CPU? Is vsync enabled or disabled?

    Anyway I really do not think QML garbage collection plays any part in this performance.



  • I've checked that on Windows 7 and its rather smooth, too, even that it runs on 10 years old laptop.

    Jerkyness is easily noticeable and reproduces constantly and consistently: extremely jerky at the very start of the application and then it becomes acceptably smooth with periodical (approximately over a constant time period) freezes for a short time.

    Veryfied issue on Ubuntu 12.04 laptop. Sync to VBlank is enabled in NVIDIA X Server Settings.



  • I've updated my video graphics adapter driver to the most recent version, and now animation is rather smooth, except for some flickering.


Log in to reply