Beginners question C++ / QT C++
-
hello there;
Normely C++ is known to be verry fast/performence program lang
how does compare
Writing C++ with QT interface
howmutch does the gui interface slows it downs 10 - 20 % ?
After writing QT puts it in C++ code and then compile it to machiene code is this correct? -
Hi if you're not showing a gui with graphics or video, just letters and menus then the gui will slow down your program very little (< 1%).
And yes, Qt's C++ compiles to machine code (In a Qt Quick app, you can have Javascript which is slower.)
-
Hi, and welcome to the Qt Dev Net!
[quote author="PointerA" date="1404440410"]Normely C++ is known to be verry fast/performence program lang
how does compare
Writing C++ with QT interface
howmutch does the gui interface slows it downs 10 - 20 % ?[/quote]It depends on your code. If you write good, efficient code, you won't notice any slowdown. If you write bad, inefficient code, your program will be slow.Qt itself is highly optimized, and can be used for live "audio processing":http://qt-project.org/doc/qt-5/qtmultimedia-spectrum-example.html and "graphing":http://qt.digia.com/Product/Qt-Enterprise/Advanced-Data-Visualization/ (see the video on the right).
[quote]After writing QT puts it in C++ code and then compile it to machiene code is this correct?[/quote]Correct. Qt is a C++ library.
(hskoglund mentioned Qt Quick, which uses the "QML language":http://qt-project.org/doc/qt-5/qmlapplications.html. It is a bit slower than C++, but depending on your use case, you might not notice any slowdowns either)
-
Hi
as mentioned before, it really depends on your programming skills.
One of the biggest beginner mistake is to put heavy calculation algorithm into the GUI thread. Than the GUI response can be slow down especially when you develop on embedded devices.For QML in the enterprise edition there is a QtQuick compiler which generates native code from QML.
I hope that this QtQuick compiler will be soon available in the free edition.
Best regards
Juergen
-
Since Qt is written in C++ which is indeed a fast language there won't be any slow down from it.
Qt adds very little overhead performance to any code you write. < 1% like hskoglund said.
For instance if you did:
@
#include <QLabel>
#include <QGuiApplication>int main(int argc, char *argv[])
{
QApplication app(argc, argv);QLabel *label = new QLabel("hello world");
label->show();return app.exec();
}
@That code would be just as fast as if you wrote to the GUI API for your platform. Or there would be a very small difference in performance.
C++/C will always be faster than any other implementation (java/c#/etc) with the exception of assembly. Even a badly programmed gui in c++ will still be faster than a java one. :)