Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Why is moc so slow when moving from qt 5.4 to qt 5.6?
Forum Updated to NodeBB v4.3 + New Features

Why is moc so slow when moving from qt 5.4 to qt 5.6?

Scheduled Pinned Locked Moved Solved General and Desktop
mocqt5.4qt5.6windows764bit
7 Posts 2 Posters 4.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jakob
    wrote on last edited by
    #1

    Recently we upgraded from Qt 5.4.0 to Qt 5.6. Of the latter I don't know the exact version, because we really needed a certain fix, and we compiled a nightly version ourselves. In the near future (when we made an upcoming milestone that is) we will change over to the official released version.

    One thing we noticed though is that moc.exe seems to have gotten a lot slower. Our full project would typically build in about 30 mins. After the updates we got a full 12 minutes extra (almost 50%), and investigation seems to show this can be described to moc.exe. We run on Win7, where we use CMake to generate the solution file for the project.

    On the internet I noticed others complaining about a slow moc.exe as well, but those message always are about an upgrade from qt 4.x to qt 5.x, never about the upgrade we just performed.

    What could be the cause of this?
    Can certain (missing) compiler options cause moc.exe to run very slowly?
    Could we maybe increase performance if AUTOMOC is turned off?
    Are there changes in moc that may cause this pretty severe performance loss due to how we organize our code?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Maybe a silly question but did you also update the CMake version ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 2 Replies Last reply
      0
      • SGaistS SGaist

        Hi,

        Maybe a silly question but did you also update the CMake version ?

        J Offline
        J Offline
        Jakob
        wrote on last edited by
        #3

        @SGaist The silly questions very often lead to the big questions, and indeed I didn't mention any details about the CMake version.

        We didn't update. We have been running CMake 3.2.3 before and after the Qt update.

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Maybe a silly question but did you also update the CMake version ?

          J Offline
          J Offline
          Jakob
          wrote on last edited by Jakob
          #4

          @SGaist Just learned that on some of the build systems we also run cmake 3.3.0-rc1.

          Nevertheless, on my personal pc I actually use 3.4.0, but all these versions result in the same behaviour, and all these versions have remained the same when we upgraded the qt version.

          While typing Visual Studio just started building a project called 'Widgets', which contains all our custom QWidgets. It stuck for close to 10 minutes on the initial build step that says 'Starting build...', and in the process explorer I could tell that for all these five minutes it was continuously firing moc.exe. Then finally all the moc-files came spitting out very quickly, and the build proceeded.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jakob
            wrote on last edited by
            #5

            I have now gathered some actual data. I checked our own application just before we merged the update from Qt5.4 to Qt5.6, then build the 'Widgets' library in our repository, which contains our reusable custom components. Then I checked out the revision just after that, where we merged the update.

            Before the merge, it took 1m40s to do the moc.exe runs (Qt 5.4)
            After the merge, it took 4m50s to do the same (Qt 5.6)

            So, moc.exe takes ~3 times more time for us. That I think is quite a significant performance hit, and should not happen. So I really hope someone has some pointers as to why this could happen: compiler options? Project structure?, ......

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Well, sounds strange that just updating Qt, the performance goes down like that.

              A quick look at the log of moc's related changes makes me think things should have gotten faster.

              Can you test a simpler project to see if you still see that performance hit ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              J 1 Reply Last reply
              0
              • SGaistS SGaist

                Well, sounds strange that just updating Qt, the performance goes down like that.

                A quick look at the log of moc's related changes makes me think things should have gotten faster.

                Can you test a simpler project to see if you still see that performance hit ?

                J Offline
                J Offline
                Jakob
                wrote on last edited by
                #7

                @SGaist So, last week our integrator had a moment of lucidity, and realized that we were actually using a debug-version of moc.exe instead of a release-build...........

                I did a quick test with a release build of moc.exe, which took the exact same measurement I mentioned above back to 1m10s, so indeed faster than with the 5.4-version, as you expected.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved