Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-780

QtMocScanner performance issues

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 1.4.2
    • 1.4.0
    • General
    • None
    • 886ab87bdf12468d0d32c2541437cd7174f486d7, 5feaa6b6e667b2f9e3171cbead16c556e0d9f301

    Description

      While profiling QBS on clean build on a large project I noticed some performance problems:

      1. A lot of time were spent in QtMocScanner::findIncludedMocCppFiles because of const char *->QString conversion. Wrapping them with QStringLiteral solved the problem. Another problem in the same function is calling ScanResultCache::Dependency::filePath function. It creates temporary strings to obtain full path to a file, when the only thing we need is to check whether it starts with "moc" and ends with ".cpp". Replacing it with fileName and checking that dirPath is empty results in much faster and maybe correct code. These changes resulted in speeding up dry run on clean build from 2 minutes to 1.

      2. Function runScanner in qtmocscanner.cpp forgets to add to cache scan results if file couldn't be opened or it is empty. The problem is that during moc scan on a clean build there is no generated files (moc, ui), and it results in many cache misses (on our project i got around 1300000 misses and therefore file->open calls). After adding them to cache dry run sped up by another 2x to 30 sec.

      Attachments

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

        Activity

          People

            jbornema Joerg Bornemann
            tgolyi Alex Telishev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes