Skip to content

Commit f7c3f30

Browse files
authored
Update pubgrub to set-based outdated priority tracking (#11169)
Looks like the set based prioritize tracking from pubgrub-rs/pubgrub#313 is a slight speedup. I assume the changed derivation tree in the error snapshot is due to out-of-sync virtual package priorities, while the main package priority defining the solution remains stable. ``` $ hyperfine --warmup 2 "./uv-main pip compile --no-progress scripts/requirements/airflow.in --universal" "./uv-branch pip compile --no-progress scripts/requirements/airflow.in --universal" Benchmark 1: ./uv-main pip compile --no-progress scripts/requirements/airflow.in --universal Time (mean ± σ): 115.0 ms ± 4.8 ms [User: 131.0 ms, System: 113.6 ms] Range (min … max): 108.1 ms … 125.8 ms 25 runs Benchmark 2: ./uv-branch pip compile --no-progress scripts/requirements/airflow.in --universal Time (mean ± σ): 105.4 ms ± 2.6 ms [User: 118.5 ms, System: 113.5 ms] Range (min … max): 101.1 ms … 111.9 ms 28 runs Summary ./uv-branch pip compile --no-progress scripts/requirements/airflow.in --universal ran 1.09 ± 0.05 times faster than ./uv-main pip compile --no-progress scripts/requirements/airflow.in --universal ```
1 parent d27e41a commit f7c3f30

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ petgraph = { version = "0.7.1" }
133133
platform-info = { version = "2.0.3" }
134134
proc-macro2 = { version = "1.0.86" }
135135
procfs = { version = "0.17.0", default-features = false, features = ["flate2"] }
136-
pubgrub = { git = "https://github.com/astral-sh/pubgrub", rev = "648aa343486e5529953153781fc86025c73c4a61" }
136+
pubgrub = { git = "https://github.com/astral-sh/pubgrub", rev = "b70cf707aa43f21b32f3a61b8a0889b15032d5c4" }
137137
quote = { version = "1.0.37" }
138138
rayon = { version = "1.10.0" }
139139
reflink-copy = { version = "0.1.19" }
@@ -177,7 +177,7 @@ tracing-tree = { version = "0.4.0" }
177177
unicode-width = { version = "0.1.13" }
178178
unscanny = { version = "0.1.0" }
179179
url = { version = "2.5.2", features = ["serde"] }
180-
version-ranges = { git = "https://github.com/astral-sh/pubgrub", rev = "648aa343486e5529953153781fc86025c73c4a61" }
180+
version-ranges = { git = "https://github.com/astral-sh/pubgrub", rev = "b70cf707aa43f21b32f3a61b8a0889b15032d5c4" }
181181
walkdir = { version = "2.5.0" }
182182
which = { version = "7.0.0", features = ["regex"] }
183183
windows-registry = { version = "0.4.0" }

crates/uv-resolver/src/resolver/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,10 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
391391
.map(|(p, v)| format!("{}=={}", state.pubgrub.package_store[p], v))
392392
.join(", ")
393393
);
394-
// Choose a package .
395-
let Some(highest_priority_pkg) =
394+
// Choose a package.
395+
// We aren't allowed to use the term intersection as it would extend the
396+
// mutable borrow of `state`.
397+
let Some((highest_priority_pkg, _)) =
396398
state.pubgrub.partial_solution.pick_highest_priority_pkg(
397399
|id, _range| state.priorities.get(&state.pubgrub.package_store[id]),
398400
)

crates/uv/tests/it/pip_install_scenarios.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,17 +531,17 @@ fn excluded_only_compatible_version() {
531531
532532
----- stderr -----
533533
× No solution found when resolving dependencies:
534-
╰─▶ Because package-a==1.0.0 depends on package-b==1.0.0 and only the following versions of package-a are available:
534+
╰─▶ Because only the following versions of package-a are available:
535535
package-a==1.0.0
536536
package-a==2.0.0
537537
package-a==3.0.0
538-
we can conclude that package-a<2.0.0 depends on package-b==1.0.0.
538+
and package-a==1.0.0 depends on package-b==1.0.0, we can conclude that package-a<2.0.0 depends on package-b==1.0.0.
539539
And because package-a==3.0.0 depends on package-b==3.0.0, we can conclude that all of:
540540
package-a<2.0.0
541541
package-a>2.0.0
542542
depend on one of:
543-
package-b<=1.0.0
544-
package-b>=3.0.0
543+
package-b==1.0.0
544+
package-b==3.0.0
545545
546546
And because you require one of:
547547
package-a<2.0.0

0 commit comments

Comments
 (0)