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

Calling a C++ function from QML/JS intermittently takes ages to complete

    XMLWordPrintable

Details

    Description

      Here is a simple test:

      import QtQuick 2.4

      Timer

      { running: true repeat: true interval: 1 onTriggered: Qt.vector3d(0, 0, 0); }

      And here the profiling result after 30 seconds of QML profiling (the profiler has been launched 10 seconds after the app started to avoid initialisation phase) :

      Location Type Time in Percent Total Time Calls Mean Time Median Time Longest Time Shortest Time Details
      <program> 100.00 % 344.098 ms 1 344.098 ms 344.098 ms 344.098 ms 344.098 ms Main Program
      main.qml:8 Signal 100.00 % 344.098 ms 18928 18.179 µs 14.082 µs 2.287 ms 3.218 µs onTriggered: Qt.vector3d(0, 0, 0);
      main.qml:8 JavaScript 80.28 % 276.240 ms 18928 14.594 µs 11.139 µs 2.281 ms 2.628 µs onTriggered

      Take a look at the Javascript execution time for just an instantiation of a Qt.vector3d (same thing happens for ordinary calls to C++ function, custom or not):

      Mean 14.594µs - Median 11.139µs - Longest 2.281ms - Shortest 2.628µs

      If the Mean time seems fair, the longest is wayyy to long for something so basic. And this profiling has been made on a high end cpu. But on my android phone it results in very annoying intermittent visual lags.

      Related topic on the Qt forum : https://forum.qt.io/topic/62606/inconsistent-computation-times-during-q_invokable-function-calls/3

      Attachments

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

        Activity

          People

            aalpert Alan Alpert
            dioxyde Olivier Carre
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes