Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML apps take long time to load
Qt 6.11 is out! See what's new in the release blog

QML apps take long time to load

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 603 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aaronwg
    wrote on last edited by aaronwg
    #1

    Hi. I have a QML app and when deploying release builds it takes a long time to start up. I've tried it on a bunch of machines and VMs and it seems to range between 3 and 10 seconds for anything to appear depending on the machine.

    I tried precompiling all my QML using the CMAKE code specified by Qt documentation but the launch time appears to remain unchanged.

    This is the CMAKE code I'm using for non-precompiled qml:

    find_package(Qt5Core)
    find_package(Qt5Network)
    find_package(Qt5Gui)
    find_package(Qt5Qml)
    find_package(Qt5Quick)
    find_package(Qt5QuickControls2)
    find_package(Qt5QuickCompiler)
    
    set(HEADERS
        ...
        ...
        ...
    )
    
    set(SOURCES
        main.cpp
        ...
        ...
        ...
        qml.qrc
    )
    
    add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${HEADERS})
    target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
    
    target_link_libraries(${PROJECT_NAME}
        Qt5::Core
        Qt5::Network
        Qt5::Gui
        Qt5::Qml
        Qt5::Quick
        Qt5::QuickControls2
    )
    

    and this is the CMAKE code I'm using to precompile the QML:

    find_package(Qt5Core)
    find_package(Qt5Network)
    find_package(Qt5Gui)
    find_package(Qt5Qml)
    find_package(Qt5Quick)
    find_package(Qt5QuickControls2)
    find_package(Qt5QuickCompiler)
    
    set(HEADERS
        ...
        ...
        ...
    )
    
    set(SOURCES
        main.cpp
        ...
        ...
        ...
    )
    
    qtquick_compiler_add_resources(RESOURCES qml.qrc)
    add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${RESOURCES} ${HEADERS})
    target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
    
    target_link_libraries(${PROJECT_NAME}
        Qt5::Core
        Qt5::Network
        Qt5::Gui
        Qt5::Qml
        Qt5::Quick
        Qt5::QuickControls2
    )
    

    I'm led to believe by Qt documentation (https://doc.qt.io/qt-5/qtquick-deployment.html#ahead-of-time-compilation) that the second should result in a faster to load QML application when deployed but this doesn't appear to be the case.

    On my current machine (pretty beefy threadripper 2920X with a GTX 1070) both the precompiled and non-precompiled versions of the app are taking around 4 seconds to display a Window from the point of double clicking the exe, and this is a pretty small application.

    Is there anything I can do to speed up that initial load time? (Qt 5.12.3)

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved