Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

qtquickcompiler



  • In my code,
    I have added CONFIG+=qtquickcompiler to build my code.
    I am profiling my code to check for the timing of opening of a page.
    So in the type , there is a compilation time added in the begining.

    So i tried CONFIG-=qtquickcompiler to build my code. And the behavior was same.

    So what is the difference between having qtquickcompiler and without qtquickcompiler?


  • Moderators

    @Anita said in qtquickcompiler:

    So what is the difference between having qtquickcompiler and without qtquickcompiler?

    I think it's always enabled since Qt 5.12 or something like it. Or was it replaced by QML cache mechanism? Not sure. But it is likely that it's simply a dummy config flag in modern Qt version.


  • Moderators

    Ah, this page offers more insight: https://doc.qt.io/qt-5/qmldiskcache.html

    You can also specify CONFIG += qtquickcompiler in your .pro file to perform the compilation ahead of time and integrate the resulting byte code directly into your executable. For more information, see Qt Quick Compiler.

    So, you most like already have precompiled code stored in QML cache location - that's why you see no difference. Clear the cache and try again - a difference should be there.


  • Moderators

    @Anita in the project settings (in QtCreator)

    85167b1e-4b38-4804-844b-824ebda3019c-image.png

    is the combobox Qt Quick Compiler set to enabled ?

    I believe thats the default for quite some versions and probably replaces the CONFIG += qtquickcompiler



  • To try and detect whether the qtquickcompiler config option is taking effect or not, you might refer to a recent thread about what exactly ends up inside a DLL (or Linux so) when that setting is toggled on or off: https://forum.qt.io/topic/121561/compiled-qml-sources-visible-inside-executable

    Specifically, you can see that by running (on Linux) the strings tool against a library, there will be symbols such as:

    _ZN21QmlCacheGeneratedCode23_qml_YourTypeName...
    

    inside a library when the qtquickcompiler option has been applied.

    If there is an open question lingering here that says "Hey, I have enabled qtquickcompiler but I still see last-minute, just-in-time compilation happening and slowing down my page load.... what is going on?"

    Discussion on that other thread led to a bug link, which then led to "re-discovery" and discussion of this commit:

    https://codereview.qt-project.org/c/qt/qtdeclarative/+/271898

    The commit message on that commit:

     Using the Qt Quick Compiler would [in the past] exclude the original .qml files ...
    This made it impossible to change the Qt library binary later as the program binary was tied the to the exact Qt version.
    

    If I understand that correctly, it implies that even when the optimized _ZN21QmlCacheGeneratedCode23_qml_ symbols are compiled into your DLL, they will potentially be ignored/unused if the Qt Framework DLL(s) at launch time are different than the Qt Framework DLL(s) used during build time.

    Depending on deployment tactics for your app, and depending on the terminal or other desktop environment settings that apply when you launch the app, it is entirely possible to unintentionally launch with (for example) a system-wide copy of the Qt Framework DLL(s), which might be a different set of DLL(s) than some developer-specific Qt framework instance installed in a non-standard folder that was used during the build.



  • That's a super interesting link from @sierdzio . I was unaware of QML_DISK_CACHE_PATH and QML_DISABLE_DISK_CACHE environment variables!

    They are apparently fairly recent additions. Apparently, prior to Qt 5.15.0, disk cache path cannot vary. Since then, it can vary based on environment variable QML_DISK_CACHE_PATH.


Log in to reply