Avatar for the astral-sh user
astral-sh
uv
BlogDocsChangelog

Performance History

Latest Results

pep440/version: fix dead "already trimmed" fast-path in `only_release_trimmed` (#19425) ## Summary `only_release_trimmed` is intended to short-circuit with a cheap `.clone()` when the release segment already has no trailing zeros. The guard condition was: ```rust if last_non_zero == self.release().len() { ``` `rposition` returns a zero-based index, so its maximum possible value is `len - 1`. The value `len` is unreachable, making the "Already trimmed" branch permanently dead code. Every call — including the common case of already-trimmed versions like `1.2.3` or `3.11` — fell through to the `else` branch and performed a redundant `Self::new(...)` allocation. Fix: change the condition to `last_non_zero + 1 == self.release().len()`, which is true exactly when the last non-zero index is the final element of the slice. `only_release_trimmed` is called on hot paths in version specifier simplification, version range normalization, and marker algebra. ## Test Plan Verified by reading `rposition`'s contract in the standard library docs — it returns `Option<usize>` where the index is always in `0..len`. The corrected condition can be confirmed by tracing through representative inputs: - `[1, 2, 3]` → `last_non_zero = 2`, `2 + 1 == 3` ✓ fast-path clone - `[1, 2, 0]` → `last_non_zero = 1`, `1 + 1 != 3` → trims to `[1, 2]` ✓ - `[0, 0, 0]` → `rposition` returns `None` → `Self::new([0])` ✓ --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
main
1 hour ago
Limit to non-pre-release, etc.
Dev-X25874:fix/pep440-only-release-trimmed-fast-path
1 hour ago
Resolve project environment in `uv python find --project` (#11990)
sashetov:sashetov/11990-python-find-respect-project
11 hours ago

Latest Branches

CodSpeed Performance Gauge
+1%
pep440/version: fix dead "already trimmed" fast-path in `only_release_trimmed`#19425
2 hours ago
abd410f
Dev-X25874:fix/pep440-only-release-trimmed-fast-path
CodSpeed Performance Gauge
+1%
Only perform unix specific steps when installing python for a unix ta…#19424
9 hours ago
68ac237
rroohhh:foreign_python_install
CodSpeed Performance Gauge
+1%
© 2026 CodSpeed Technology
Home Terms Privacy Docs