Skip to content

Suppression file name cache.#8684

Open
MartinBP wants to merge 3 commits into
cppcheck-opensource:mainfrom
MartinBP:suppression-filename-cache
Open

Suppression file name cache.#8684
MartinBP wants to merge 3 commits into
cppcheck-opensource:mainfrom
MartinBP:suppression-filename-cache

Conversation

@MartinBP

@MartinBP MartinBP commented Jul 1, 2026

Copy link
Copy Markdown

Implement a file name cache per suppression to avoid calling PathMatch::match again and again for the same suppression and file name combination.

Local benchmark running cppcheck with misra c-2012 has been performed.

Before
10min 34sec
After
1min 36sec

In this test it was a few header files producing the majority of the error messages, which is why the cache speeds it up by a lot.

Implement a file name cache per suppression to avoid calling PathMatch::match
again and again for the same suppression and file name combination.
@firewave firewave self-assigned this Jul 2, 2026
@glankk

glankk commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Looks good

@firewave

firewave commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

As this is a global cache it might have side effects when the object is used for more than one analysis. This applies to the tests and might also apply to the GUI. As the suppressions are always mutable if both of them have usage issues they have been pre-existing. We should check and fix any issues before we merge this to make sure things don't get worse.

@firewave

firewave commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

We should also add a performance test for this in Python.

@firewave

firewave commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Also needs a ticket.

@MartinBP

MartinBP commented Jul 2, 2026

Copy link
Copy Markdown
Author

Thanks for the feedback.
I have added a few comments below.

As this is a global cache it might have side effects when the object is used for more than one analysis. This applies to the tests and might also apply to the GUI. As the suppressions are always mutable if both of them have usage issues they have been pre-existing. We should check and fix any issues before we merge this to make sure things don't get worse.

I'm afraid that this expands a little beyond the knowledge I currently have of this project.

We should also add a performance test for this in Python.

Is this something you (or someone else) can assist with?
Or can you point me to some performance test that has already been implemented to get some inspiration.

Also needs a ticket.

Should I create one? In that case I will just need to request access first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants