Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-17245

Clang: Slow parsing/completion due to not existing ui header files

    XMLWordPrintable

Details

    Description

      Opening any project with a *.ui file whose corresponding ui_*.h is not yet written to disk leads to slow libclang performance regarding reparse/completion in any file (also from other projects).

      Reproduce by following these steps:

      1. Start Qt Creator within an environment containing LIBCLANG_TIMING=1 to get generate some debugging output.
      2. Open some project without any *.ui files, e.g. create a Qt Console Application from the wizard.
      3. Edit the opened main.cpp once (e.g. hit Enter at end) and wait some seconds until no more output is generated.
      4. Edit main.cpp again and it should generate
        clangbackend.stderr: Reparsing /home/nik/work/testprojects/untitled2/main.cpp:   0.0920 (100.0%)   0.0080 (100.0%)   0.1000 (100.0%)   0.1010 (100.0%)
        

        This is repeatable - for each edit a reparse happens.

      5. Load a project with *.ui files which was not yet build, e.g. create a Qt Widgets Application from the wizard and close the opened document because we are not interested in that one.
      6. Edit main.cpp again, this time it will precompile the preamble before each reparse:
        clangbackend.stderr: Precompiling preamble:   1.0600 (100.0%)   0.0120 (100.0%)   1.0720 (100.0%)   1.0708 (100.0%)  
        
        clangbackend.stderr: Reparsing /home/nik/work/testprojects/untitled2/main.cpp:   1.1520 (100.0%)   0.0160 (100.0%)   1.1680 (100.0%)   1.1700 (100.0%)
        

        This is repeatable - for each edit the preamble is precompiled and a reparse happens.
        In the output, the very last number is the wall clock time. "Precompiling preamble" is part of "Reparsing". Note that the reparses now are about 10x slower due to the extra preamble precompilation.

      7. Close the second project or build it. Then, edit main.cpp again and see that parsing is fast again.

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-17245
        # Subject Branch Project Status CR V

        Activity

          People

            kosjar Nikolai Kosjar
            kosjar Nikolai Kosjar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes