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

Huge slowdown on mac with Qt 5.4.1

    XMLWordPrintable

Details

    • macOS
    • 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
        2. pi.trace.zip
          270 kB
        3. pi.zip
          1 kB
        4. pi-simplified.zip
          2 kB
        5. profiling.png
          profiling.png
          199 kB
        6. qt-5.4.1-full.patch
          24 kB
        7. specs.png
          specs.png
          54 kB

        Issue Links

          For Gerrit Dashboard: QTBUG-46959
          # Subject Branch Project Status CR V

          Activity

            People

              sorvig Morten Sørvig
              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