We got a pretty big codebase: ~800k LOC, ~3000 compilation units, C/C++.
We need to analyse this for:
Win amd64 (msvc)
Lin amd64 (gcc)
Lin arm64 (gcc)
Since there is no support for different os/arch yet, we suffix the branches. arm64 is marked as default branch.
We use ADO and compilation database based scan. Windows and Linux agents both have 8 cores and same amount of ram.
We use selfhosted SQ (Enterprise Edition v2025.4.4 (119049)).
I have tracked the time it takes
There is the pipeline side Analysis (SonarQubeAnalyze@7). I call this the “Scan” since we used to use the cli sonar scanner for that. Then there is the SQ Server side analysis (Background Tasks). I call this “Analysis”.
I ran the same branch 2 times:
Scan
Scan #2 (cached)
Analyse
Analyse #2
win x64
7m58s
4m17s
22m
17m
lin x64
42m5s
2m31s
21m
18m
lin arm64
44m40s
2m25s
29m
17m
You can clearly see the benefits of caching for the scan, but next to none for the analysis.
I have a few questions:
Why is the initial scan on Windows that much faster, wheres builds are normally faster on Linux.
Why is the cached scan in windows that much slower?
Why does the cached analysis not improve significantly?
How can i optimize the analysis? 3x20 min (not parallel!) is way too much for a PR build.
I understand you are aware of our multi-code variants feature, which is a more elegant solution that suffixing branches. Are you sure you can’t perform all analyzes on a single machine? The architectures you mention are not too exotic, and cross-analyzing might work.
For the more general question of performance, I’m forwarding this post to the relevant people.
It would however be interesting, as a reference, to also have timings for building the code. For instance, maybe the good initial perfs on Windows are related to the use of PCH?
Yes I am aware of that feature. But it is unusable for multi-platform build (Building on different OS: Win/Lin/MacOs) in general and in our case it would simply take too long if its done serially.
In these jobs we do not build at all. Just CMake to get compile_commands.json, then directly SQ. There are no precompiled headers lying about. But for reference, our build times are approx.: Win amd: 21 min, Lin amd: 24min, Lin arm: 29min
Sorry for the long delay before this answer. We had an internal reorg, and investigating this topic is once again in my purview.
I’d first like to share a few points/questions:
Which part now takes 20s? The “scan” part or the “analyze” part?
This is why I mentioned cross analysis, for instance analyzing everything on Windows. You are right that the “scan” part would then be serialized, leading to longer analysis, but the the “analyze” part would only have to be performed once. I can’t say how long it would last, but probably significantly less that 3*20 min, closer to 20 minutes. But I understand that it is difficult to put in place, so let’s focus on your initial report.
That is no surprise to me. Only the “scan” is incremental, but it always send the full results to the “analyze”.
Could you provide us with the “scan” logs for the 6 analyses you mention in your first post? (I’m sending a private message for you to upload them privately). They also contain data that may help us understand the “analyze” part. Can you also tell us which database you are using?
Sorry, thats was a mixup on my side. The “analyze” part improves to ~20s.
I will prepare those reports, but they will be different from the original claims. We reduced the scanned LOC by ~50%, so the times are now also ~50%. I am right now porting to a new branch, therefore it is a good time for that
I looked at the logs you provided, and I did not see anything strange about them. The different incremental parts that happen during the “scan” phase seem to do their work correctly.
The result that is passed the the “analyse” phase is between 20k and 30k issues (no matter if incremental or not, which is expected). I’m forwarding this to the team in charge of this phase.
By the way, I asked you which database you are using, but could not find an answer.