[Qt-creator] clangd parsing time

Eike Ziller Eike.Ziller at qt.io
Wed Dec 1 10:59:39 CET 2021


Hi,

I have got a fix for macOS (in LLVM), and a similar patch that _might_ improve things on Windows too

https://codereview.qt-project.org/c/clang/llvm-project/+/382042

but since we fail to reproduce the huge difference between "compiling" and "clangd indexing" that you observe in the first place, we have a difficult time verifying that this indeed helps.

We have created a build of clangd with the potential fix and I've uploaded it here:

https://download.qt.io/development_releases/prebuilt/libclang/testing/

it would be great if you could test if this improves things for you. Set the path to the new clangd in Tools > Options > C++ > Clangd > Path to executable.

Br, Eike

> On Nov 9, 2021, at 15:26, Eike Ziller <Eike.Ziller at qt.io> wrote:
> 
> I can confirm on macOS, that Qt Creator in Qt Creator takes 2 1/2 hours to index, on a machine that takes 12 minutes to build it.
> clangd uses 12 threads by default, but only 4 out of 8 cores. Turning up the number of "worker threads" does increase the number of threads used, but doesn't increase the cores/CPU used and doesn't make indexing faster.
> 
> The good thing is that the full indexing is only done once (cached per build directory), and further updates just index what has changed.
> 
> It seems to be known in principle in the Clangd project:
> 
> clangd is keeping notify indexing and won't stop in Windows with Chromium · Issue #643 · clangd/clangd
> https://github.com/clangd/clangd/issues/643
> 
> and seems to be different on Linux.
> 
> Br, Eike
> 
>> On Nov 8, 2021, at 19:57, Adam Light <aclight at gmail.com> wrote:
>> 
>> Hi
>> 
>> I'm using QtC 6.0.0-beta2 on Windows 10.
>> 
>> I wanted to give clang a try so I enabled the "Use clangd" option. I have Enabled background indexing checked, worker thread count set to Automatic, and Document update threshold set to 500ms.
>> 
>> I deleted all of the build directories for my project and then opened the project in Creator. After a few seconds a "Parsing C/C++ files (clangd)" popup appeared with a progress bar and file count. It shows that it needs to parse 3495 files.
>> 
>> After having run for 15 minutes now, the popup says that 216 files have been parsed.
>> 
>> Building a debug build of this qmake-based project on this Windows machine takes about 2 minutes. That is using the MSVC compiler, not clang. The machine has a 16 core/32 thread processor and 32GB RAM. Building the same project on an older Macintosh machine with 4 cores/8 threads takes about 5-6 minutes. In that case clang is the compiler.
>> 
>> I collected some ETW traces and I verified that clangd is running in 16 threads. Unfortunately, the debug symbols for Creator (https://download.qt.io/development_releases/qtcreator/6.0/6.0.0-beta2/installer_source/windows_x64/qtcreator-debug.7z) do not include symbols for clangd, so I have no idea what the bottleneck is.
>> 
>> I realize that clangd is considered experimental, but surely it's not this slow for others, right? If this isn't expected, I'm open to helping to debug what's going on, if someone has ideas about how to do so.
>> 
>> Thanks
>> Adam
>> 
>> PS: As I am about to send this, it's been 26 minutes since parsing started, and it's finished only 375 files.
>> _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at qt-project.org
>> https://lists.qt-project.org/listinfo/qt-creator
> 

-- 
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Erich-Thilo-Straße 10
D-12489 Berlin
eike.ziller at qt.io
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Qt-creator mailing list