High CPU usage with basic QML animation
-
wrote on 8 Mar 2016, 13:47 last edited by
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 } } }
-
wrote on 13 May 2016, 08:35 last edited by
I have the same problem.
Help. -
wrote on 18 Aug 2021, 23:57 last edited by
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.
-
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.
wrote on 19 Aug 2021, 17:11 last edited byHi @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++. -
wrote on 19 Aug 2021, 18:10 last edited by JoeCFD
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. -
wrote on 1 Jan 2022, 06:35 last edited by
Here is a bug report: https://bugreports.qt.io/browse/QTBUG-99525
Please vote/watch it if you face the same problem.