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

Huge slowdown on mac with Qt 5.4.1

    XMLWordPrintable

    Details

    • Platform/s:
      macOS
    • Commits:
      53ecaade10319ecc1d8115521ae6d8eba1ee55c1

      Description

      Attached is a zip file with simple Qt application that creates a QMainWindow with a QSatusBar, and calls update() on the status bar 10 times per second.

      The mac machine I am using is an absolute beast (see specs.png), and even on this machine the application steadily consumes about 20% CPU usage - which is absurd since it does practically nothing.

      It seems the reason is because updating the status bar will trigger a repaint of the main window, which will result in the entire main window's image being copied in QImage::detach(). The reason we copy the image before we paint it is because somebody else holds a reference to the main window's image data (I suspect in libqcocoa.dylib).

      Thus, we are copying the entire main window's image data every time a tiny widget is updated. Extrapolate that to a more complex application and it's obvious that things will be very uncomfortable.

      I collected some profiling results (see profiling.png and pi.trace) that verify we spend a huge amount of time inside QImage::copy(), just by letting the app run idle for about a minute.

      Is there something I am missing here? I could not find any similar bug reports, and it does not appear to be fixed with Qt 5.4.2.

        Attachments

        1. anti-slowdown.patch
          7 kB
          Michael Eischer
        2. pi.trace.zip
          270 kB
          Troy Bowman
        3. pi.zip
          1 kB
          Troy Bowman
        4. pi-simplified.zip
          2 kB
          Michael Eischer
        5. profiling.png
          199 kB
          Troy Bowman
        6. qt-5.4.1-full.patch
          24 kB
          Troy Bowman
        7. specs.png
          54 kB
          Troy Bowman

          Issue Links

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

            Activity

              People

              • Assignee:
                sorvig Morten Sørvig
                Reporter:
                troybowman Troy Bowman
              • Votes:
                3 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes