Latest Results
Avoid full site-packages scans for direct reinstalls (#20119)
## Summary
`uv pip install` currently indexes every installed distribution before
resolution, even when installed packages cannot affect the result. Large
environments therefore pay for metadata reads unrelated to the packages
that can actually be modified.
This defers the site-packages scan whenever installation uses sufficient
semantics and resolution does not need the installed environment. With
`--reinstall`, `Reinstall::All` excludes installed candidates for every
selected package, including transitive dependencies. When installing
from a `pylock.toml`, the resolution is derived directly from the lock
and likewise does not consult installed packages. Exact installation
semantics retain the full scan because they must identify extraneous
packages for removal. After resolution, we index only installed
distributions whose names occur in the resolution.
## Performance
Measurements of the direct-reinstall path on a separate machine show
larger improvements as the installed environment grows:
| Fixture | Baseline | Patched | Change |
| --------------------------------------------- | -------: | -------: |
-----: |
| 1,000 installed distributions, full reinstall | 200.4 ms | 183.7 ms |
-8.3% |
| 2,000 installed distributions, full reinstall | 223.9 ms | 182.9 ms |
-18.3% |
| 2,000 distributions, dry-run/planning path | 202.3 ms | 158.7 ms |
-21.5% | Latest Branches
0%
charlie/codex-lockfile-parse-fast-path 0%
charlie/codex-sitepackages-reinstall-fast-path +11%
© 2026 CodSpeed Technology