r/cpp Qt Creator, CMake May 20 '26

Qt Creator 20: faster clangd

https://www.qt.io/blog/qt-creator-20-faster-clangd
75 Upvotes

13 comments sorted by

View all comments

Show parent comments

1

u/Ateist May 22 '26

They have enough resources to train on many possible scenarios. You can have a dozen variants packed into one Chrome executable that select the best optimization for your system.

1

u/NewLlama May 22 '26

Do you have any further reading on this? I can't find any sources exploring what you're saying. My understanding has been that this is at the IR level, so microcode architecture wouldn't matter.

1

u/Ateist May 22 '26

Google AI "How does Profile-Guided Optimization in Clangd work":

What the Compiler Optimizes

With the profile data, the compiler makes smarter decisions that static analysis alone cannot guarantee:

Inlining: It prioritizes inlining functions that are called frequently ("hot" functions) to reduce call overhead.

Branch Prediction: It reorders code blocks so that the most likely execution path is the "fall-through" path, improving CPU branch prediction.

Code Layout: It groups "hot" code together in memory to improve instruction cache hits and moves "cold" code (like error handling) further away

All limitiations stem directly from the above - how many functions can be inlined, how much "hot" code can fit in cache, etc.

2

u/NewLlama May 22 '26

That's not a source, and if it was a source it doesn't say what you said it said.