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

Leslie Zhai xiang.zhai at i-soft.com.cn
Thu Sep 17 03:32:27 CEST 2015



在 2015年09月16日 17:51, Konstantin Tokarev 写道:
> 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.
Yes, plasma-framework 
https://projects.kde.org/projects/frameworks/plasma-framework/repository 
developed QML Extension Plugin and easy-to-import in QML example 
https://github.com/xiangzhai/plasma-helloworld

But such as plasma-workspace`s krunner 
https://projects.kde.org/projects/kde/workspace/plasma-workspace/repository/revisions/master/show/krunner 
and kwin`s tabbox 
https://projects.kde.org/projects/kde/workspace/kwin/repository/revisions/master/show/tabbox
I prefer to directly operate QML object in C++ via objectName too, so in 
this situation, it is not able to use QML Compiler, right? then is it 
better to re-architecture some KDE5 projects to follow the QML Extension 
Plugin way?

And is there some benchmark to compare before and after compiled with 
QML Compiler for small and big project?


>
> 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.
Thanks for your advice ;-) I will fallback to light DE when OpenGL 
profiling score is low.


>

-- 
Leslie Zhai




More information about the Development mailing list