Uh oh!
There was an error while loading. Please reload this page.
Improve performance of SuppressionsList::isSuppressed by returning as soon as a match is found - #8668
Conversation
… soon as a match is found. The same is done in the other overloads of the function. By returning immediately when a match is found, heavily improve the performance of CppCheck::CppCheckLogger reportErr function in cases where a lot of errors are being suppressed.
firewave
commented
Jun 22, 2026
Thanks for your contribution. Please provide more details on "heavily improve the performance". It is possible that this is done intentionally here for the This also requires a ticket. |
I ran a test that produced 20755 error messages and the majority of those were suppressed (>99%).
On my setup (Windows 11 and Intel i7-1260p) the total time went down from 1min 32sec to 45sec. I have a support ticket open related to slow performance, but it might not be related to the finding I have made here, so creating another ticket would make sense.
The unmatchedSuppression handling is unaffected by this change. |
MartinBP
commented
Jun 22, 2026
I missed a side effect in the isMatch function. I will have to investigate what impact this have. |
firewave
commented
Jun 23, 2026
That is probably the "intentional behavior" I meant. The suppression stuff is unfortunately quite complex and there's several things I am still working on. We also need to check if it doesn't cause any regressions with #7079 applied. |
Instead of returning immediately just avoid calling isMatch when a match is already found and the suppression being checked has previously been matched.
MartinBP
commented
Jun 23, 2026
And you were right :) I have reverted most of the code and instead added a minor optimization that skips calling isMatch when a match has already been found and the suppression being checked has previously been marked as "matched = true". In my test the time went down from 1min 32sec to 1min 25sec, so no longer a huge save. |
MartinBP
commented
Jul 1, 2026
I did some further debugging and it turned out that the main bottleneck in the suppression check is the file path check (at least in my setup), which made me implement a cache for just that. The mentioned pull request pretty much makes this one redundant. |
glankk
commented
Jul 2, 2026
Closing in favor of #8684 |
Improve performance of SuppressionsList::isSuppressed by returning as soon as a match is found.
The same is done in the other overloads of the function. By returning immediately when a match is found, heavily improve the performance of CppCheck::CppCheckLogger reportErr function in cases where a lot of errors are being suppressed.