Update: Since Qt 5.12, the QtQuick compiler has been available under LGPLv3. Even if you don’t have a commercial Qt license, you will be able to enjoy a significantly faster startup of embedded QML applications.
It is not easy to find hard data about how much the QtQuick compiler can speed up the startup of real-life application. As I had some time on my hands this weekend, I measured the startup times of the HMI of a maize harvester running on a quad-core NXP/Freescale i.MX6 (Nit6Q_W_BCOM). Using the QtQuick compiler from Qt 5.7 brings the startup time from 2.72s down to 1.91s – a speedup of 30%!
I measured the time from starting the application to showing the home screen, which is the point when the user can start interacting with the HMI. As you can see from the screenshot, the home screen is a pretty complex QML screen and hence a good optimisation target for the QtQuick compiler. The QML code of the home screen wasn’t optimised for faster startup at all.
I connected the
frameSwapped() signal of the HMI’s
QQuickView with the
quit() slot of
QCoreApplication. This signal is emitted whenever the rendering engine flips the back and front framebuffer, that is, when the back buffer becomes visible. The very first emission of
frameSwapped() after startup makes the Home screen visible. Connecting this signal with exiting the application allowed me to use the Linux command
time to measure the startup time. The HMI application is terminated at exactly the point where the user could start interacting with it.
Without the QtQuick compiler, the startup takes 2.72 seconds (the sum of user and system time). With the QtQuick compiler, the startup takes only 1.91 seconds. The QtQuick compiler speeds up the startup of the harvester HMI by 0.81 seconds or 30%. I only had to add
CONFIG+=qtquickcompiler to the qmake call and rebuild my application. This is very little effort for a 30% speedup!