Hi,

I think there's a trade-off to be made with regards source (url) vs. 
sourceComponent.

If the component your loader is trying to load is small, then you're better off 
using sourceComponent. While
the parser and the type compiler is "warm" it should take little time to do the 
one-time work of compiling it. It
would take a fair bit of additional CPU cycles to schedule a load of an 
external file, fire up the parser and the
type compiler for just a few lines. If the component is big, then it's 
definitely worth it to use source (url) instead
of sourceComponent.

So there are two "curves" that meet at some point. As long as your component is 
small, I'd keep it inline. When it
grows, move it into a separate file.

Simon

________________________________________
From: development-bounces+simon.hausmann=theqtcompany....@qt-project.org 
<development-bounces+simon.hausmann=theqtcompany....@qt-project.org> on behalf 
of Guenter Schwann <guenterli...@schwann.at>
Sent: Wednesday, September 16, 2015 12:12
To: development@qt-project.org
Subject: Re: [Development] How to speed up QML for KDE5 without QML compiler

On Wednesday 16 September 2015 12:03:38 Leslie Zhai wrote:
> 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).

Hi,

One generic advise is to use the Loader item a lot. So only visible/needed
items are created.
This helps a lot for the startup performance.

And in the Loader rather use the source instead of the sourceComponent
property (or use the setSource() function). As the sourceComponent still
parses all stuff (although the binding is the biggest time consumer usually).

It will make your code more complex. And of course has it's limits and might
not be your biggest bottleneck. But usually helps a lot.

--
Guenter Schwann

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to