Skip to content

oelint.vars.pathhardcode: Fix computational complexity#843

Merged
priv-kweihmann merged 2 commits intopriv-kweihmann:masterfrom
michalsieron:master
Feb 22, 2026
Merged

oelint.vars.pathhardcode: Fix computational complexity#843
priv-kweihmann merged 2 commits intopriv-kweihmann:masterfrom
michalsieron:master

Conversation

@michalsieron
Copy link
Contributor

There is no need to do have two nested loops just to check if any of the (pre, ext) combinations are in the line. One can easily search for a regex pattern which uses regex alternations.

Fixes #842.

Brings time to check one file (even with RegexRpl) in use from ~18 s to 0.5 s for me.

There is no need to do have two nested loops just to check if any of the
(pre, ext) combinations are in the line. One can easily search for a
regex pattern which uses regex alternations.

Fixes priv-kweihmann#842.

Signed-off-by: Michal Sieron <michalwsieron@gmail.com>
@priv-kweihmann
Copy link
Owner

@michalsieron tests are good, are you fine with the PR as well, or is there more you want to do?

@michalsieron
Copy link
Contributor Author

michalsieron commented Feb 21, 2026

I think that's all. RegexRpl's slowness is not visible anymore, once there aren't hundreds of thousands of regex searches being done
RegexRpl is not visible on a single recipe check, but when ran on entire oe-core, it very much is. Difference on my laptop is something like re - 24 s vs RegexRpl - 61 s.
But I don't think I want to undertake that, especially not in this PR.

So if you are ok, with current changes, then please merge, but it seems the original issue will need to be updated and kept open.

As it turns out, checking if searched path is present in line before
we do the search with regex, can cut down time by another 50%.

Signed-off-by: Michal Sieron <michalwsieron@gmail.com>
@michalsieron
Copy link
Contributor Author

@priv-kweihmann I know I said I won't do anything in this PR, but after some more digging, I found something with which I may be happy to close the linked issue. With this new commit I don't really see any difference between RegexRpl and re when running this check on oe-core.

@priv-kweihmann priv-kweihmann merged commit 1dfdc29 into priv-kweihmann:master Feb 22, 2026
5 checks passed
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.

RegexRpl significantly increases linting time for oelint.vars.pathhardcode

2 participants