Skip to content

perf(gazelle): look for a missing gazelle_python.yaml only once - #4481

Open
Shamsidinkhon wants to merge 3 commits into
bazel-contrib:mainfrom
Shamsidinkhon:gazelle-missing-manifest
Open

Shamsidinkhon wants to merge 3 commits into
bazel-contrib:mainfrom
Shamsidinkhon:gazelle-missing-manifest

Conversation

@Shamsidinkhon

Copy link
Copy Markdown

Since manifests are loaded lazily (#2746), FindThirdPartyDependency tries to load the manifest of the importing package and of each parent package every time it resolves a module name. A manifest that exists is loaded once and kept, but a missing one is looked for again on every call. In a repository where only the root has a manifest, that is an os.Stat per parent directory for every candidate module name of every import.

To fix, the config now remembers that its manifest doesn't exist, and later calls skip it. SetGazelleManifestPath clears the flag, so a new path is still looked up.

The generated BUILD files are unchanged.

I wrote this change with an AI coding assistant (Claude Code) and reviewed it myself. I'll read and answer review comments personally; no agent posts on this PR.

Since manifests are loaded lazily (bazel-contrib#2746), `FindThirdPartyDependency` tries to load the manifest of the importing package and of each parent package every time it resolves a module name. A manifest that exists is loaded once and kept, but a missing one is looked for again on every call. In a repository where only the root has a manifest, that is an `os.Stat` per parent directory for every candidate module name of every import.

To fix, the config now remembers that its manifest doesn't exist, and later calls skip it. `SetGazelleManifestPath` clears the flag, so a new path is still looked up.

The generated BUILD files are unchanged.

This branch has not been deployed

No deployments
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.

1 participant