Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. High CPU usage with basic QML animation
QtWS25 Last Chance

High CPU usage with basic QML animation

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 6 Posters 2.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pvaibhav
    wrote on last edited by
    #1

    Hello,

    I was seeing bad performance and high cpu usage in my QML based apps, as much as 50-100% on iOS (device or simulator), and even desktop. After optimising my code as much as I could, I decided to write the simplest possible animated app to isolate the root cause.

    Strangely, even with just a rotating label, I still get 17-20% cpu usage consistently. My ObjC based native iOS app which rotates a png image barely registers above 1% cpu usage. There isn't much code (see below) to profile, and I am not able to make sense of tracing the compiled app using Instruments.

    Any help will be appreciated.

    Code below:

    import QtQuick 2.5
    import QtQuick.Window 2.2
    
    Window {
        visible: true
    
        MouseArea {
            anchors.fill: parent
            onClicked: {
                Qt.quit();
            }
        }
    
        Text {
            text: qsTr("Hello World")
            anchors.centerIn: parent
            NumberAnimation on rotation {
                from: 0
                to: 360
                duration: 4000
                loops: Animation.Infinite
            }
        }
    }
    
    
    1 Reply Last reply
    0
    • drunkwolfsD Offline
      drunkwolfsD Offline
      drunkwolfs
      wrote on last edited by
      #2

      I have the same problem.
      Help.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ratijas
        wrote on last edited by
        #3

        Years later, CPU usage of animations is still a problem. Getting 70% CPU wasted on rotating Shape and animating its PathAngleArc's startAngle and sweepAngle.

        ndiasN 1 Reply Last reply
        0
        • R ratijas

          Years later, CPU usage of animations is still a problem. Getting 70% CPU wasted on rotating Shape and animating its PathAngleArc's startAngle and sweepAngle.

          ndiasN Offline
          ndiasN Offline
          ndias
          wrote on last edited by
          #4

          Hi @ratijas ,
          I don't get significant high CPU values running at least simple animations. Can you provide a sample code and some clarifications about your setup?
          I'am using PySide (Python Qt binding) on my side. I have never tried using QML with C++.

          1 Reply Last reply
          0
          • JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by JoeCFD
            #5

            I created a small test case to display a GIF file and it uses about 10%CPU. The root cause is that it runs too fast?
            If a loop over call of a func which does almost nothing can use a lot of CPU.

            1 Reply Last reply
            0
            • H Offline
              H Offline
              hamer
              wrote on last edited by
              #6

              Here is a bug report: https://bugreports.qt.io/browse/QTBUG-99525
              Please vote/watch it if you face the same problem.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved