[Development] How to speed up QML for KDE5 without QML compiler

Konstantin Tokarev annulen at yandex.ru
Wed Sep 16 11:51:36 CEST 2015



16.09.2015, 07:04, "Leslie Zhai" <xiang.zhai at i-soft.com.cn>:
> Hi great Qt and KDE developers,
>
> I like QML, it is high speed development language, easy to create candy
> UI and not difficult to debug. KDE4 began to use it in some projects,
> for example, KScreen`s kcm module, it used QML to take place of
> traditional QWidget. and KDE5, it is full of QML, for example, kwin`s
> tabbox, plasma-desktop and plasma-workspace`s applet, sddm, etc.
>
> For a new PC, there is no sharp difference between QML and QWidget, but
> in a very very old PC, how old? about 7 years ago, QML is very slow! and
> it needs to close all effects for KDE5, even that when clicked, for
> example, calendar applet, it hang about 3+ seconds to showPopup.
>
> There is commercial QML compiler, a very small example tried to use it
> https://github.com/AOSC-Dev/AOSC-VersionHelper2
> But is it suitable for huge projects just like KDE5 if bought a
> commercial license? because not all KF5 components follow the Qt Quick
> Compiler`s resource.qrc way, so is it able to compile? for example,
> kickoff applet (the start menu of KDE5).
>
> --
> Regards,
> Leslie Zhai - a KDE developer

You might want to use generic approach working for any scripting language:
1) profile; 2) find bottlenecks; 3) rewrite them in "fast" language (C++ here)

As for rewrite from QML to C++:

1. Try to move all business logic and computations to C++ classes, make this code
available to QML via QObject-derived classes (see "Defining QML Types from C++"
document and also docs for qmlRegisterType and qmlRegisterSingletonType)

2. Identify reusable QML items and rewrite them in C++ using class derived
from QQuickItem. See "Writing QML Extensions with C++" document.

Another possible cause of sluggish performance is suboptimal usage of OpenGL.
Try to use best drivers available for your graphics hardware. You might also
consider using OpenGL profiling tools.

-- 
Regards,
Konstantin



More information about the Development mailing list