[Interest] Qt Quick Compiler 2.0

Daiwei Li daiweili at gmail.com
Mon Jan 19 08:17:22 CET 2015


Hi Nuno,

I've experienced crashing with the android_armv7 qtquickcompiler on OSX.
After some digging, I found that it was due to the generated .cpp being
incorrect for certain JS literals and expressions (see
http://pastebin.com/raw.php?i=KaT2aB72 for more examples). This trivial
example:

function f1()
{
  return 0.1;
}

would get compiled to something like:

QV4::ReturnedValue jsfunction_1(QV4::ExecutionContext *context) // f1
{
    QV4::Scope scope(context);


// line 3
    context->d()->lineNumber = 3;

// line 4
    context->d()->lineNumber = 4;
*return QV4::Primitive::emptyValue().asReturnedValue();*

}

whereas the correct compilation should be:

QV4::ReturnedValue jsfunction_1(QV4::ExecutionContext *context) // f1
{
    QV4::Scope scope(context);


// line 3
    context->d()->lineNumber = 3;

// line 4
    context->d()->lineNumber = 4;
*return QV4::Primitive::fromDouble(0.1).asReturnedValue();*

}

In my case, the literal was in an object, and getting an emptyValue when
accessing a value in an object was causing a crash deep in V4. As a
workaround, I'm currently using the clang_64 qtquickcompiler, which does
emit the right code.

Performance-wise, using qtquickcompiler cuts down my application's start-up
time from around ~7-10 seconds to ~3-4 seconds on a Nexus 5. I'm guessing I
could cut this down even further if I compile the QML files from Qt itself
(i.e. QtQuick, QtQuick.Controls, Qt.GraphicalEffects, etc...). I haven't
made any attempts to measure run-time performance but I would guess the
difference wouldn't be as pronounced there.

Daiwei



On Sun, Jan 18, 2015 at 5:37 AM, Nuno Santos <nunosantos at imaginando.pt>
wrote:

> I have tried again and the crash is gone…
>
> I would still love to understand if this qt quick compiler will improve
> performance on iOS and Android. Couldn’t notice a perceptible difference
> after running it with.
>
> Thanks,
>
> Regards,
>
> Nuno
>
> On 18/01/2015, at 12:29, Nuno Santos <nunosantos at imaginando.pt> wrote:
>
> Hi,
>
> After reading http://doc.qt.io/QtQuickCompiler/ and realising that my
> license supported Qt Quick Compiler I decided to give it a try.
>
> I was already using Qml files bundled in a Qt resources file so I just
> needed to add CONFIG += qtquickcompiler to my project configuration.
>
> I have a complex project with a lot of qml files. The result was an
> immediate crash just after launching it.
>
> I thought Android and iOS deploying was already taking advantage of Qml
> compilation and inclusion into the binary. Does this add any extra
> performance and security when deploying to iOS and Android?
>
> What about the crash? Should I try this feature file by file in order to
> understand that is causing the crash?
>
> Thanks,
>
> Regards,
>
> Nuno Santos
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150118/9b45f0d0/attachment.html>


More information about the Interest mailing list