dev: processor optimizations #5316
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was working on the new exclusion configuration #5297, and I found some "optimizations".
IdentifierMarker
processor update:PathAbsoluter
processor:Cgo
processor and theFilenameUnadjuster
then now thePathAbsoluter
does that once.analysis.Diagnostic
are absolute.PathPrettifier
(it already exists) converts absolute path to relative (related to the different elements but mainly to exclusions)This is not only "optimizations", the
PathAbsoluter
is something I will use with the new exclusion system.I found another optimization: the usage of
FileCache
insidemisspell
.The
FileCache
is used bySourceCode
,ExcludesRules
,severity
,Fixer
processors, andmisspell
.The
FileCache
is loaded with file content and the keys are paths, butmisspell
is the only one that uses absolute paths to load/read data from/to the cache.So the cache is filled but never used.
This allows to reduce the memory usage (ex: on k8s this 50MiB)
These are minor optimizations: a few seconds, but they can impact large projects.
To avoid creating a PR for exclusions with some off-topics, and as those elements are standalone, I prefer to create a PR with just these processors.