Speed performance of deployed application: Linux vs Windows
-
The performance is closely related to the MinGW version (the higher usually the better, the 4.4 which comes with Qt4 is heavily outdated and has known performance issues) and threading model used (posix or win32).
Yes, you can use MSVC to release commercial (and non-commercial) open- and closed-source applications.
Have you tried profiling your application to find out where it actually loses performance?
-
Creation/destruction of threads is really well optimized on Linux. If you are using short-lived threads then a thread pool might help by avoiding many of those constructions/destructions.
Basically you implement a pool where you get threads from, have them do something and then return them to the pool for reuse later. I've seen dramatic speedups from using such pools before.
-
Hi guys,
I'm having a really hard time trying to figure out and/or installing the "latest version of Qt". A little help or advice would be very welcome.
On Windows, I have installed the latest SdK. But then I realized the Qt version it used was 4.8.1, whereas the latest one is 4.8.3. So I downloaded the (minGW) 4.8.3 libraries for Windows, ran it (it's an exe), that installed Qt in C:\Qt\4.8.3. Then in the options of Qt creator (Build & Run / Version of Qt) , I added a version of qt by selected the qmake.exe in the appropriate subfolder.
Problems and questions:How do I know the latest version of MinGW (the one I just installed?) is used? If I go in "tool chains" (still in Qt creator options / Build & Run), it says mingw-32-g++.exe is fetched in the C:\QtSDK... folder, which seems suspicious? On the other hand, I can't find any other minGW on my hard drive..
Do I also need to worry about the version of g++ used or something?
Now the build of my app fails, says it refuses to handle exceptions (and suggests to compile with an option that doesn't work). Why is that happening? By the way, it doesn't matter all that lot, I only use exceptions to throw errors (although I did spend a lot of time managing my exceptions "properly). Do you think I should permanently get rid of exceptions?
Even if I comment all the "throws" to avoid this, I get another error: something like "can't find file qrc_resources.cpp", which doesn't happen usually. Why?
Furthermore, it seems that now if I build & run my app with the previous configuration (Qt 4.8.1) then it's much slower than before (but I've not investigated that at all, so don't be concerned about that)
On Linux (Ubuntu), I have installed Qt (and then Qt creator 2.5.0) by installing lib-qt4-dev. But same thing, that only incorporates Qt 4.8.1. So I downloaded the sources of 4.8.3 (for Linux 64bits), extracted them in my home folder, and I built them. Then I selected the Qt version in Qt Creator just like above. It seems to work, pretty much, except that
now my windows, and buttons, and everything look terribly "basic" in an ugly way. What's going on?
I must admit, the time and effort I've spent trying to deploy my app is giving my nerves a hard time. Maybe today's (and yesterday's) lesson is that I should just use the Qt version provided with my "Qt environment"? (but if I want to use the MinVC compiler...)
Thanks for helping!
-
You said you installed a new version of Qt... did you install a new version of mingw in addition to that? Qt does not contain a mingw, only the Qt SDK does. The old one should be fine, but a newer one might produce faster code, so you might want to grab a new copy of mingw from the net.
-
The mingw Qt was build using mingw, it does not contain mingw. If you did not download mingw separately then you won't have a new mingw compiler to install in creator.
-
My experience it the same. I had a Qt program running in my laptop, core i5, with a dual boot, Windows 7 64b versus Linux Mint 64b. My program would make some math calculations and then draw a graph in QGLWidget. It took about 7ms in linux versus 16ms in Windows. I was using Qt SDK with mingw in windows.
-
[quote author="seubri" date="1350448721"]On Windows, I have installed the latest SdK. But then I realized the Qt version it used was 4.8.1, whereas the latest one is 4.8.3. So I downloaded the (minGW) 4.8.3 libraries for Windows, ran it (it's an exe), that installed Qt in C:\Qt\4.8.3. Then in the options of Qt creator (Build & Run / Version of Qt) , I added a version of qt by selected the qmake.exe in the appropriate subfolder.
Problems and questions:How do I know the latest version of MinGW (the one I just installed?) is used? If I go in "tool chains" (still in Qt creator options / Build & Run), it says mingw-32-g++.exe is fetched in the C:\QtSDK... folder, which seems suspicious? On the other hand, I can't find any other minGW on my hard drive..[/quote]That is fine, nothing suspicious at all. The Qt library (i.e. headers + DLLs) and MinGW are separate components -- the latter is bundled in the SDK, but is not in the Qt 4.8.3 library installer you downloaded.
MinGW provides the compiler (i.e. GCC). The MinGW that comes bundled in the SDK contains GCC 4.4, which is the latest version supported by Qt. In fact, since you've installed pre-built Qt 4.8.3, you NEED to use GCC 4.4 -- the latest MinGW contains GCC 4.7, which is binary-incompatible with your Qt 4.8.3 DLLs. If you want to use GCC 4.7, you need to get it from the MinGW site (http://www.mingw.org/wiki/Getting_Started ) AND THEN use it to build Qt 4.8.3 DLLs from source.
[quote]# Do I also need to worry about the version of g++ used or something?[/quote]GCC 4.4 definitely works. GCC 4.7 definitely doesn't work. Not sure about GCC 4.5 or 4.6.
Edit: "Works" = "works with the pre-built libraries downloaded from the website"[quote]# Now the build of my app fails, says it refuses to handle exceptions (and suggests to compile with an option that doesn't work). Why is that happening? By the way, it doesn't matter all that lot, I only use exceptions to throw errors (although I did spend a lot of time managing my exceptions "properly). Do you think I should permanently get rid of exceptions?[/quote]Hmm... I don't use exceptions myself so I'm not sure, but I'm guessing that the pre-built libraries had exceptions disabled (with the -no-exceptions flag during configuration). I guess your options are:
Use your downloaded Qt 4.8.3, remove exceptions from your code
Compile Qt 4.8.3 yourself with exception support, continue using exceptions in your code.
In general, whether exceptions should be used or not is a decision up to the programmer; there's plenty of debate on the topic.
[quote]# Even if I comment all the "throws" to avoid this, I get another error: something like "can't find file qrc_resources.cpp", which doesn't happen usually. Why?[/quote]Could this be the same issue as http://qt-project.org/forums/viewthread/21032/ ?
[quote]# now my windows, and buttons, and everything look terribly "basic" in an ugly way. What's going on?[/quote]Maybe Qt has defaulted to a different style. Try calling QApplication::setStyle() in main(), to pick a style you like.
-
Apparently I messed up sending my last post. I was thanking Tobias Hunger and john_god for their insights.
JKSH, thank you so much! I really appreciate you taking the time to answer each one of my questions, Things are much clearer now. So, again, thanks!
So, I guess that if I trust Lukas geyer:
"The performance is closely related to the MinGW version (the higher usually the better, the 4.4 which comes with Qt4 is heavily outdated and has known performance issues)"
then I should get the latest MinGW version from their website and build Qt 4.8.3 from the sources on my Windows using it (yuk, but I should be able to do that). -
You're most welcome, and good luck with compilation.
Small tip: Since you're compiling for Windows, you need to use the "configure.exe" executable, not the "configure" script, even if you're in MSYS (which is a Unix-like environment for Windows, from the MinGW project)