QtQuickCompiler gives me mixed results

  • Hi all,

    I'm developing app for Linux Embedded Freescale i.MX6, so the performance is critical for us. I'm using QtQuickCompiler but it doesn't give me clear results in QmlProfiler. Compiler works because during the compilation it compiles the HomePage.cpp, SettingsPage.cpp and other QML->CPP files, so everything should be good.

    I ran few tests with and without compiler and I can't see any significant difference as the results in both cases fluctuate around similar numbers.

    Each test was done as following:

    • remove binary from device
    • reboot device (to make sure that any temp cache will be cleared)
    • deploy & run app + attach QmlProfiler

    Results from QmlProfiler (numbers presenting 'Compiling' time from profiler):

    1. Without compiler1:
      main.qml: 414ms
      HomePage: 200ms
      SettingsPage: 152ms
      IndicatorTest: 110ms

    2. Without compiler2:
      main.qml: 315ms
      HomePage: 100ms
      SettingsPage: 123ms (total showing page in 160ms)
      IndicatorTest: 49ms (total showing page in 220ms)

    3. Without compiler3:
      main.qml: 490ms
      HomePage: 100ms
      SettingsPage: 160 (total 192ms)
      IndicatorTest: 100 (total 260ms)

    4. With compiler1:
      main.qml: 320ms
      HomePage: 100ms
      SettingsPage: 57ms
      IndicatorTest: 53ms

    5. With compiler2:
      main.qml: 320ms
      HomePage: 106ms
      SettingsPage: 71ms (total 153ms)
      IndicatorTest: 100ms (total 284ms)

    6. With compiler3:
      main.qml: 320ms
      HomePage: 100ms
      SettingsPage: 66ms (total 144ms)
      IndicatorTest: 68ms (total 242ms)

    7. With compiler4:
      main.qml: 467ms
      HomePage: 93ms
      SettingsPage: 60ms (total 149ms)
      IndicatorTest: 69ms (total 239ms)

    Additionally, I put time checking in code like:

    console.time("Loading page took")
    console.timeEnd("Loading page took")

    But times were pretty much the same for with and without compiler.

    Some info about the project:

    • dev env: ArchLinux with QtCreator 4.7.2
    • Freescale i.MX6 with Debian 9.5, 4.9.11-02286-gaa81171-dirty
    • custom Qt 5.11.1 build with: ./configure -release -opengl es2 -device linux-imx6-g++ -device-option CROSS_COMPILE=gcc-linaro-6.3.1-2017.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -prefix /opt/qt5.11.1 -opensource -nomake tests -nomake examples -sysroot /opt/qtrootfs -qt-xcb -qt-xkbcommon-x11
    • all import statements are in "qrc:/absolute/path" format
    • qml loaded with QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    • 16 singleton QML models
    • ~20 setContextProperty with CPP models/managers
    • ~200 *.qml files
    • Application is being run with:
      • LD_LIBRARY_PATH with: qt libs + all our dependencies
      • qputenv("QML2_IMPORT_PATH", LD_LIBRARY_PATH + "/qt5/qml/");
      • qputenv("QT_PLUGIN_PATH", LD_LIBRARY_PATH + "/qt5/plugins");

    I also created sample project in QtCreator: File->New->Application->QtQuickApplication-Stack and I put 20 Rectangles in Column with color set to ""#"+((1<<24)*Math.random()|0).toString(16)". I wanted to check what will results look like for simple example app.

    I ran few tests for each case and compiling time were as following:

    Without qtquickcompiler:
    main.qml: ~200ms
    form: ~28ms

    with compiler:
    main.qml: ~200ms
    form: 2ms - 4.5

    It was always around 200ms for main.qml, no matter if I was using compiler. For the form.qml on the other hand it was 28ms against 3ms (avg) - the numbers weren't fluctuating at all. I ran around 10 tests, all results were the same. But maybe the file could be optimized due to its simple structure?

    My questions are:

    • why the values for with and without compiler doesn't differ in my big project?
    • why it's always 200ms for main.qml in example app and there was only a difference for component I created dynamically?
    • why it's compiling the QML files even when I'm using QtQuickCompiler? It was always compiling file once in app lifetime. I opened my project, then navigated to SettingsPage and IndicatorTestPage - QmlProfiler showed that it compiled these sources. Then I went back to HomePage and navigated again to Settings and Indicator pages and QmlProfiler showed only 'Creating' times - there was no compilation at all when creating pages again (I'm using StackView.push("qrc:/file/path.qml")). But restarting application caused again in QmlProfiler showing 'Compiling'

    Am I doing something wrong? Does someone have any clue what could be possibly wrong?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.