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

Performance History

Latest Results

Test no project case
tk/centralised-environments
3 hours ago
Track project origin files
tk/index-by-name
3 hours ago
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
14 hours ago
Limit to non-pre-release, etc.
Dev-X25874:fix/pep440-only-release-trimmed-fast-path
14 hours ago

Latest Branches

CodSpeed Performance Gauge
0%
Centralised environment storage#18214
2 months ago
d01febd
tk/centralised-environments
CodSpeed Performance Gauge
0%
1 month ago
815e353
tk/index-by-name
CodSpeed Performance Gauge
+1%
pep440/version: fix dead "already trimmed" fast-path in `only_release_trimmed`#19425
14 hours ago
abd410f
Dev-X25874:fix/pep440-only-release-trimmed-fast-path
© 2026 CodSpeed Technology
Home Terms Privacy Docs