introduced a cache for followAllReferences() calls#7192
Conversation
|
This essentially eliminates any meaningful impact by
Clang 19
The example from https://trac.cppcheck.net/ticket/10765#comment:4: Clang 19
|
Sorry, something went wrong.
|
Something really weird is going on here in the UBSAN job: The timing information for |
Sorry, something went wrong.
|
Before After |
Sorry, something went wrong.
42d1ec9 to
b38e8ba
Compare
January 8, 2025 13:04
b38e8ba to
a36380e
Compare
January 14, 2025 15:38
|
Could we merge this without the debug integration for now (I will file a ticket about doing that)? I would like to clean up and test the existing debug output first (see #7258 - as usual stalled) before I add new data. And it would greatly speed up the CI as well as giving a baseline to compare against if running it as a pass would have significant performance impact. |
Sorry, something went wrong.
a36380e to
f54680c
Compare
April 5, 2025 08:08
|
This should be done in the symboldatabase either before or during exprids. |
Sorry, something went wrong.
|
Thanks for the feedback. Some of the shortcomings were intentional since it seemed to make things simpler and I wanted to get the performance improvement in. But I remembered the changes to be simpler which is not the case so I need a bit to get into it again. |
Sorry, something went wrong.
|
@pfultz2 How should the information be presented in the debug output? I also assume it should be a separate section. |
Sorry, something went wrong.
fb74dde to
6699af7
Compare
June 3, 2025 12:18
In the limited cases I tested that produced considerably more calls to |
Sorry, something went wrong.
followAllReferences() calls with default parameters|
Given the improvement this change provides and how it affects the CI (we are actually getting even slower and not having this applied makes it harder to pinpoint the other hot spots) I would really prefer if we could just merge the very first version and do the adjustments as a follow-ups. |
Sorry, something went wrong.
|
Having this done in incremental commits would also make it possible to bisect differences in behavior/performance this might have based on the stage this cache is generated. Especially after I tried to add a different cache in #7573 which relies on that the results are not being cached beyond a point (which might also cause issues here if this is stored too early - but might not be reflected in our tests). |
Sorry, something went wrong.
1031202 to
92ad6f3
Compare
September 15, 2025 18:39
|
I dropped the changes to generate these beforehand as it was too unspecific. The performance gains are just too big to delay this any longer. I will file a ticket and publish a PR with the WIP code later. And I would really prefer that to land it in separate commits anyways so it will make it easier to distinguish possible issues caused by adding the cache and by precomputation of the cache. I am not also confident the data might actually correct when precomputated after working on #7573 (I am trying to improving guardrails so we could detect that). I also confirmed that adding the cache shows no differences with #7800. |
Sorry, something went wrong.
92ad6f3 to
90c3d46
Compare
September 15, 2025 18:49
e8ba4f3 to
fdef434
Compare
October 13, 2025 01:31
It looks really nice! Did you measure in Windows also? As far as I know we have had a focus on Linux and I fear it might have hurt Windows experience. I am talking with a customer, they say it takes 40 minutes for them to scan their project in Linux and 17-18 hours in Windows, using similar hardware. Some more info:
so well it might be an idea to start measuring performance both with -j1 and -jX. I can also reproduce that Cppcheck is much slower in windows than in Linux. |
Sorry, something went wrong.
Official Windows release binaries are still built without Boost - see https://trac.cppcheck.net/ticket/13823. All pieces are in place and the only thing left was a step which downloads it and only extracts it partially (will have a look later). Are the Linux binaries built with Boost?
That should only be the case if you have a lot of very small files which generates a lot of output (i.e. debug warnings enabled) when using the process executor (caused by the IPC). Multi-threaded being slower than single-threaded with a long running analysis seems impossible to me. The worst case should be the longest running file in a multi-threaded analysis. And since Windows has no process executor that does not even apply. From my own experience I would assume be that there is an issue in the configuration leading to Windows having to process more code from includes than Linux. Enabling It could also be the case that all the system includes are provided and that the Windows versions of them (or the Windows SDK includes which are not used on Linux) are much heavier. Adapting the simplecpp selfcheck for Windows might be a first step to get a baseline difference of the cost of the system includes. |
Sorry, something went wrong.
they used Cppcheck Premium binaries and these do not use boost.
That is very reasonable but I do not think that is the case. We have significant multithreading slowdown when checking cppcheck source code with such command also: |
Sorry, something went wrong.
For information.. when I run this command on my machine I get such timings: Linux: Windows: So analysis in Windows is more than 10x slower than analysis in Linux on my machine if -j16 is used. The open source cppcheck windows release binary is a bit faster but it's not much. As far as I see, switching from msvc to Clang make it even slower. :-( |
Sorry, something went wrong.
|
Please also run Linux with |
Sorry, something went wrong.
|
I did some short test on my system with a smaller file and I did not see any differences between using thread or not. The process executor code also has some other overhead unrelated to the IPC which will go away when I am done with reworking the executors. That getting awfully close but needs the remaining suppression issues resolved first since those require changes on how we set up certain things for the analysis. If no new blockers show up there I hope it will finally doe by the end of the year (main blocker is the time it takes to get stuff reviewed though). |
Sorry, something went wrong.
|
That I wrote this script: And got this output: Does this indicate that if we implement a process executor in windows we might get 10x performance boost? |
Sorry, something went wrong.
No - it indicates there is an concurrency issue when using It should be the other way around (albeit not as drastic). That is also apparent from the unit tests where tests using the process executor are much slower than tests using the thread one. But none of this has to do with the changes in this PR which will speed up things no matter the platform or threading. |
Sorry, something went wrong.
|
Do you actually have 16 thread available on your system? If you specify more threads than available the analysis will obviously be much slower since you are overloading the system. As a rule of thumb you should only utilize about 80% of the available threads if you are actively using the system, |
Sorry, something went wrong.
Please disregard. In that case it should also happen when using the processes. |
Sorry, something went wrong.
|
I am not able to reproduce this locally. I also thought it might have been caused by your CPU potentially having P- and E-cores but it not occurring with processes also rules this out. |
Sorry, something went wrong.
|
I don't know what happened but right now the times looks better. Here are times measured with So the p16 does not stand out this time. |
Sorry, something went wrong.
danmar
left a comment
There was a problem hiding this comment.
this looks good to me.
Sorry, something went wrong.
fdef434 to
364da72
Compare
October 28, 2025 11:38
|
Sorry, something went wrong.
So maybe it is E-cores? You should possibly look at the runtimes of all files. During another test I saw a difference between using |
Sorry, something went wrong.
5f301d3
into
cppcheck-opensource:main
Oct 28, 2025



No description provided.