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

Speed up Window creation in Linux



  • Is there a way of speeding up window creation in Linux? Any compilation flags that I can tweak to optimize my application for X11? Is it possible to enable XCB-only?

    I don't care about Mac/Windows, so, is there anything I can disable?



  • Why is this necessary? I've never experienced an X app in linux where the window creation is slow...but then I use a real man's window manager; none of this bloated wissy-whig crap that comes in Gnome. I use nothing more bloated than fvwm or twm on my systems. the other question is what is your graphical hardware and whos drivers are you using?


  • Lifetime Qt Champion

    @vellis How long does it take now?
    If you have performance issues in your app are you sure it is not your app but X11/Qt?



  • Booting up QT app rendering a single label and using QTimer::singleShot(0) to quit as soon as it starts:

    real 0m0.182s
    user 0m0.147s
    sys 0m0.021s

    Booting up XCB app rendering single label and using XCB_EXPOSE to quit as soon as it renders:

    real 0m0.019s
    user 0m0.005s
    sys 0m0.013s


  • Lifetime Qt Champion

    This is a completely useless comparison since it for sure take longer to load all Qt libs and create a QApplication than a simple xcb app.



  • Yes, of course! And that's precisely what my question is about: what can be enabled/disabled so I can fine tune the boot process to fit my needs.



  • @vellis said in Speed up Window creation in Linux:

    Yes, of course! And that's precisely what my question is about: what can be enabled/disabled so I can fine tune the boot process to fit my needs.

    The boot process has absolutely nothing to do with the Qt framework. It is specific to your environment and depends heavily on how your machine is configured. It is well outside of the pervue of the forum to analyze and diagnose linux bootup issues.

    FYI: bootup is the starting of the system from the point the kernel loads until it is ready to interact with the user. application startup is the time it takes to start the application once the command has been entered. Please use the correct terminology to lessen confusion.


  • Lifetime Qt Champion

    @vellis said in Speed up Window creation in Linux:

    what can be enabled/disabled

    Don't use Qt if you can't wait 100ms for your application startup process...



  • @Kent-Dorfman said in Speed up Window creation in Linux:

    The boot process has absolutely nothing to do with the Qt framework. It is specific to your environment and depends heavily on how your machine is configured. It is well outside of the pervue of the forum to analyze and diagnose linux bootup issues.

    Sorry for the misunderstanding: by boot I mean framework boot, not machine boot. What I'm referring to in this topic is exactly what @Christian-Ehrlicher said in the last post: It takes longer for Qt to load all it's libs. How can I disable that? How can I disable unnecessary libraries and parts of Qt that are not relevant to a Linux-only app? Or, what kind of tweaks are available to reduce the impact to the minimum?

    @Christian-Ehrlicher said in Speed up Window creation in Linux:

    Don't use Qt if you can't wait 100ms for your application startup process...

    Well, I can understand where you are coming from and I respect that opinion. However, what I'm asking isn't very out of this world: for a specific use case that does not consider Windows or Mac, that does not consider Library X or QML or whatever, what can be done to speed up the framework? What can be removed and tweaked?

    I highly doubt that Qt isn't flexible enough to allow developers to reduce it to its barebones, and I don't understand why my questions are being met with certain resistance.


  • Lifetime Qt Champion

    Hi,

    There's nothing non-Linux in a Linux Qt build.

    If you want to reduce load size, then go with Qt Lite and enable only what your application is using. This will make the Qt libraries lighter to load.

    See this article for an introduction to it.



  • @vellis
    May I ask a question: the example you quote is for starting up a program to show a label and then quit, and you're concerned about its timing. To me that implies you are intending to run lots & lots of times to just show a message, or something similar? Is that the sort of thing you intend?



  • @SGaist said in Speed up Window creation in Linux:

    Hi,

    There's nothing non-Linux in a Linux Qt build.

    If you want to reduce load size, then go with Qt Lite and enable only what your application is using. This will make the Qt libraries lighter to load.

    See this article for an introduction to it.

    Thank you for the link! Is there a way of building Qt lite and statically linking it to my application with CMake? Like, just add_external_project(qt_lite_folder)? Is that an intended use case?


  • Lifetime Qt Champion

    AFAIK, no.

    Qt Lite is a "complete" Qt build with a reduced feature set so you use in place of the one you are currently using for your project.

    [edit: fixed phrasing SGaist]



  • Dear OP.

    Just out of curiosity what hardware are you running this on? Please don't tell me it's a raspberry PI and that you expect prompt response on that platform, cause you aint gonna get it.

    Kind regards,
    a curmudgeony old coot who hates PIs.


  • Lifetime Qt Champion

    @vellis said in Speed up Window creation in Linux:

    for a specific use case that does not consider Windows or Mac, that does not consider Library X or QML or whatever, what can be done to speed up the framework?

    Now you're speaking from the general speed, not from a startup (and shutdown) time which happens only once a program is started / stopped which is more or less negligible (except you're starting the program thousands of times a day) which you're measuring - so my statement stays - your testcase and comparison is useless.


  • Lifetime Qt Champion

    @vellis You could build Qt statically and use this static build for your app. Loading your statically linked app should be faster compared to dynamically linked version.


  • Lifetime Qt Champion

    @jsulm said in Speed up Window creation in Linux:

    @vellis You could build Qt statically and use this static build for your app. Loading your statically linked app should be faster compared to dynamically linked version.

    Without forgetting the licensing implications if you are using the GPL/LGPL version of Qt.


Log in to reply