refactor: defer zip manifest building to execution phase to improve analysis phase performance by tobyh-canva · Pull Request #3381 · bazel-contrib/rules_python
tobyh-canva
changed the title
zip file analysis optimisation: alternate starlark-only approach
perf: improve analysis performance by for py_binary and py_test rules
rickeylev
changed the title
perf: improve analysis performance by for
refactor: defer zip manifest building to execution phase to improve analysis phase performancepy_binary and py_test rules
tobyh-canva
deleted the
create-zip-file-analysis-optimisations-3
branch
aignas added a commit to aignas/rules_python that referenced this pull request
Dec 6, 2025Looking at the investigation in bazel-contrib#3381, it seems that we are calling the startswith many times and I wanted to see if it would be possible to optimize how it is done. I also realized that no matter what target we have, we will be calling the function once with a `__init__.py` path and we can inline this case as a separate if statement checking for equality instead, which Starlark optimizer should understand better. Before this PR for every executable target we would go through the `legacy_external_runfiles and "__init__.py".startswith("external")` and this PR eliminates this. Related to bazel-contrib#3380 and bazel-contrib#3381
github-merge-queue bot pushed a commit that referenced this pull request
Dec 7, 2025) Looking at the investigation in #3380, it seems that we are calling the startswith many times and I wanted to see if it would be possible to optimize how it is done. I also realized that no matter what target we have, we will be calling the function once with a `__init__.py` path and we can inline this case as a separate if statement checking for equality instead, which Starlark optimizer should understand better. Before this PR for every executable target we would go through the `legacy_external_runfiles and "__init__.py".startswith("external")` and this PR eliminates this. Related to #3380 and #3381
github-merge-queue bot pushed a commit that referenced this pull request
Feb 15, 2026This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters