Does compiling Qt works for improving the Application's performance

  • We just finished our program, and now the thing is that the RAM usage is a little high. We have tried some effective ways to solve it, but we still want to optimize.
    So we decide to compile Qt by ourselves(qt-everywhere-src-5.14.0) through using configure command line, such as -no-feature-udpsocket, or -skip to configure, and then compiling it. The result is, the program package is lessened indeed, but it makes no difference with the RAM usage. So I want to know whether this way works for improving the application's performance(RAM or CPU usage).
    Thanks for your help.

  • Lifetime Qt Champion

    Recomping Qt should not make a dramatic effect on ram usage as
    most of that comes from the actual app.
    Stripping features might make the support DLLS smaller but
    will not affect the performance of the remaining.

    So i would analyze the app and figure out what the ram usage is and see if something can be done there.

  • @mrjj Thanks for your reply. Making support DLLS smaller is also a good thing for us. I would try another way to improve that.
    Here is another question if you don't mind. Do you have any suggestions about renaming the DLLS? For example, when I finish compiling, I hope the Qt5Core.dll could be renamed to MyCore.dll. Or does it work if I combine these DLLS, such as compiling Qt5Core.dll and Qt5Widgets.dll in one dll.
    As far as I know, I can't find a way to do this. I'm expecting for your reply.

  • Lifetime Qt Champion

    It would be complicated to rename or merge the dlls as
    the whole module system is built around those names.
    and tools like qmake links automatically to Qt5Core so
    having it uses other names might require lots of code changes.

    Why do you want to rename them?

  • Lifetime Qt Champion

    @Donation Actually, you should first find out what exactly consumes RAM in your app before hacking around with Qt. You could use Valgrind for example. Most probably it is not Qt eating the RAM/CPU.

  • @jsulm Thanks for your reply, I'm already do something to improve before. And the performance is good. I just want to know if it's useful to make my app better.

  • @mrjj It seems like a stupid idea, haha.
    My friends discussed with me about the renaming, so I also wonder if it can be done.

  • Lifetime Qt Champion

    Well technically it should be possible but the benefit is hard to see :)
    It would be like digging a hole for a swimming pool with a spoon.
    Its possible but really not recommended.

  • Moderators

    If you want more performance, use higher optimization flags (-O3 or link time optimisation). If you want smaller size, use -Os. You can't have both ;-) Maybe except one solution (if your license permits): static. With statick Qt and application, your linker will remove all unnecessary code when linking, and compiler will speed things up when optimizing.

  • @sierdzio Thanks for your help and I will try it.

  • @mrjj ok, i will leave out this idea
    Thank you again for your help

  • I also would've suggesting static linking with Qt. As @sierdzio mentioned you need to make sure to comply with the license. If you have a commercial license it don't think it is a problem (I have never had a closer look at the commercial license). If you only use your software inhouse and don't distribute it there is also no problem when using LGPL. If your software is open source then I also don't see a problem. If, however, you use Qt under LGPL and distribute your software then you need to provide every user with a way to relink your software with their own Qt version (it does not make much sense if some of it is inlined, but that is the law). Basically, you would need to provide upon request (at least) the object files of your software or your whole software packed into a library together with instructions how to link it with Qt.

Log in to reply