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

clangd: Saving a single C++ file causes high multicore CPU usage

XMLWordPrintable

    • 6a8f7ae53 (master)

      Clangd utilizes CPU too much when saving a single C++ file. Looks like it's scanning all open files instead of saved file(s). When only a single file is open, CPU overhead is low, but opening many files and saving only one of them utilizes CPU too much.

      Is it really needed to trigger clangd when saving file? It's already working while editing a file.

      Steps to reproduce:

      1. Launch QtCreator 13 with this command:

      QT_LOGGING_RULES="qtc.languageclient.messages.debug=true" qtcreator
      

      2. Open attached clangd_many_files.zip project.
      3. Open all files (double click on every CPP file in QtCreator).
      4. Modify one file (e.g. main.cpp).
      5. Save main.cpp file.

      Actual result: Clangd updates all open files (see logs).
      Expected result: Clangd doesn't do anything, because it do updates automatically when writing code.

      If it's necessary, maybe just add an option in "Clangd" tab to not scan anything on file save action?

        1. clangd_save_logs.txt
          12 kB
          Błażej Szczygieł
        2. clangd_many_files.zip
          2 kB
          Błażej Szczygieł
        3. htop-clangd.mp4
          109 kB
          Błażej Szczygieł
        4. image-2024-05-07-21-12-07-631.png
          8 kB
          Błażej Szczygieł
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            kandeler Christian Kandeler
            zaps166 Błażej Szczygieł
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes