Performance difference (Qt4 vs Qt5)



  • I've been seeing on a few different forums and mailing lists that Qt 5 has worse peformance thatn Qt 4 because the native graphics backend was removed. Has anyone done any benchmarks against Qt4 and Qt5 to see if this change has impacted performance?


  • Moderators

    Raster engine has not been removed. All Qt5 does is to add another possibility: SceneGraph.



  • I did a quick run with "qtperf":http://code.google.com/p/qtperf/ (which basically tests the QtGui / QtWidgets module and therefore the native / raster paint engine) and it shows a performance gain of Qt 5.0.1 over Qt 4.8.4 of ~23,2% (so Qt5 is roughly a quarter faster then Qt4).

    The QtQuick drawing backend in Qt5, the scenegraph, cleary "outperforms":http://blog.qt.digia.com/blog/2011/05/31/qml-scene-graph-in-master/ the native / raster paint engine.

    Qt comes with quite an extensive set of benchmarks, so feel free to do you own benchmarking for your target platform if you are in doubt.



  • Good to know. The people on the mailining lists (for the projects that use Qt) were complaining that Qt 5 was slower because the native graphics option was removed and forced you to use raster. I haven't been able to keep up with Qt 5 as much as I like so I didn't know about the scenegraph. I'll mention this on the mailing lists. It seems to be a reason some of the project don't want to migrate from Qt4 to 5.



  • I have just migrated my project of a simple moving dial using QML and there is
    a reduction in performance in Qt5

    The needle jitters as it moves, smooth in Qt4

    The QML is launched using QQuickview in QT5

    Qdeclarativeview in QT4

    How can I fix the QT5 issue ?

    ...just realised this post is a year old not a few days


  • Moderators

    In Qt5, you can tell QtQuick to offload to a different thread. But treat that as a last resort - I think the problem lies somewhere else. What are the changes in your QML for Qt5? Maybe your code is suboptimal, or you are running on Mesa drivers? Are you using the newest version (Qt 5.2.0)?



  • Thanks for picking this up

    Only changed

    import QtQuick 1.0

    to

    import QtQuick 2.0

    This is the moving element in qml

    @
    Image {
    id: needle2
    x: 678; y: 107
    smooth: true
    source: "needle.png"
    transform: Rotation {
    id: needle2Rotation
    origin.x: 17.5; origin.y:151
    //! [needle angle]
    angle: Math.min(Math.max(-60, root2.value*1.215 - 60), 200)

                    Behavior on angle {
                        SpringAnimation {
                            spring: 1.4
                            damping:.15
                        }
                    }
    }
    }
    

    @

    I see the same QT4 to QT5 difference in Windows and Linux
    Linux is my main development platform

    The OpenGL example apps run fine

    Im running 5.2

    The qml code above is the dial with slider example shipped with QT4.8 (its not in QT5)


  • Moderators

    Please edit your post and wrap the code between '@' tags: it will be much easier to read.

    I can recognize the code, yes. In Qt 5.2, you can actually bump the import to:
    @
    import QtQuick 2.1 // or maybe even 2.2, I'm not sure
    @

    Maybe you are indeed on to something wrong in Qt itself: it should be running smoothly.



  • Regarding Performance differences between Qt 4 and Qt 5, as always it depends on your use case. In the Widget stack, I would expect painting performance between 4.8 and 5.0 to be very similar. In 4.8 we deprecated the "native" painting in favour of raster, and in Qt 5 almost any use of QPainter will result in the use of the raster paint engine (except for a few cases where you will us the OpenGL paint engine instead).

    For the QML cases, QtQuick 1.x -> QtQuick 2.x will almost always be more performant in Qt 5 vs Qt 4. Here for the majority of cases (except for QQuickPaintedItem) we'll be rendering your scene in OpenGL and avoiding the QPainter abstraction all together.

    There are of course other factors than painting/rendering performance at play when discussing comparisons between Qt 4 and Qt 5, but in the case of graphics performance Qt 5 should be equal to or better than in Qt 4.



  • QtQuick 2.1 and 2.2 had the same results

    UI Componenets Dial Control Example in Qt 4.8
    ported to Qt5.2

    if its just me seeing the degraded dial movement then I need to see what im doing different, im not an experienced Qt programmer ,Qt is my first C++ experience after using C in embedded products.



  • Looking closer this dial control QML is in Qt5 install

    it doesn't appear in the welcome page of examples , but it does sit in the Qt5 install directory , all the porting changes already done.

    I loaded ready ported qml with the same problem.

    running Qt4 dialcontrol and Qt5 dialcontrol side by side on the same monitor will show the obvious difference


  • Moderators

    Hi,

    How did you run the example? I opened <Qt>/examples/declarative/ui-components/dialcontrol/dialcontrol.pro in Qt Creator, built it and ran it. It was perfectly smooth for me -- MSVC 2012 x64, OpenGL. (Although, I'm using a gaming PC with a powerful graphics card).



  • I think thats the Qt4 version using QtQuick 1.0

    there is another in C:\Qt\Qt5.2.0\5.2.0\Src\qtdeclarative\examples\quick\ui-components\dialcontrol


  • Moderators

    Ah, you're right. Anyway, I ran both versions, and here are the results:

    If I drag the slider from one end to the other, both versions are equally (very) smooth.

    If I drag the slider really slowly across, then the Qt Quick 2 version is a bit jerkier.

    I'm guessing that you saw the effects of trial #2? I think the degradation here is due to how the QML engine delivers bound values to Behavior/SpringAnimation, not due to slower graphics performace. If graphics were degraded, then you'd see the jerkiness in trial #1 too.

    Also, if you delete the "Behavior on angle" part in Dial.qml, you'll find that the graphics updates are really snappy.

    Nonetheless, it's still a degradation from Qt Quick 1. Would you like to report it to http://bugreports.qt-project.org/ ?



  • Thanks

    And yes it is test 2. slow movements , initial acceleration i would say is jerky

    Yes I would like to report it, never reported a bug before tho


  • Moderators

    Go to http://bugreports.qt-project.org/

    Create an account and log in

    Click "Create Issue" (top-right)

    Enter the following, plus your own details:

    Project: Qt

    Issue Type: Bug

    Component/s: QtQuick: Core



  • Bug posted,

    QTBUG-36709

    thanks guys for all your help


  • Moderators

    Thank you for your report!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.