Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-102759

Qt Charts are extremely slow on Android (140x slower than on Desktop)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.0, 6.3.0
    • Charts
    • None
    • Android

    Description

      Appending points to a `LineSeries` is extremely slow when running on Android.

       

      Consider the following example:

       

      main.cpp:

       

      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      #include <QApplication>
      
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QQmlApplicationEngine engine;
          const QUrl url(u"qrc:/chart-repro/main.qml"_qs);
          QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                           &app, [url](QObject *obj, const QUrl &objUrl) {
              if (!obj && url == objUrl)
                  QCoreApplication::exit(-1);
          }, Qt::QueuedConnection);
          engine.load(url);
      
          return app.exec();
      }
      
      

       

       

      main.qml:

       

       

      import QtQuick
      import QtCharts 2.3
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")    Component.onCompleted: {
              const ts = new Date().getTime();
              console.log("populating...");
              const s = series;
              for(var i=0; i<1000; i++){
                  series.append(i, i + Math.random()*400-200)
              }
              const te = new Date().getTime();
              console.log("finished in", te-ts, "ms")
          }    
      
          ChartView {
              anchors.fill: parent
              antialiasing: true
              id: chart        
      
              ValuesAxis{
                  id: xaxis
                  min: 0
                  max: 1000
              }        
      
              ValuesAxis {
                  id: yaxis
                  min: 0
                  max: 1000
              }
      
              AreaSeries{
                  useOpenGL: true
                  axisX: xaxis
                  axisY: yaxis
                  upperSeries: LineSeries {
                      id: series
                  }
              }
          }
      }
      

       

      Notice the time measuring in Component.onCompleted.  When running on a Linux PC, building the chart takes 7ms to build. On Android it takes more than 1000ms, even though it's not an old phone (Pixel 3a). This huge difference seems like something is wrong under the hood.

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            e0348803 Miikka Heikkinen
            kuba_orlik Kuba Orlik
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes