Skip to content

Commit 5f123d4

Browse files
committed
only allocate the start term if it's needed
1 parent 1533574 commit 5f123d4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/internal/partial_solution.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -485,15 +485,15 @@ impl<DP: DependencyProvider> PartialSolution<DP> {
485485
.get(satisfier_package)
486486
.expect("satisfier package not in incompat");
487487

488-
let start_term = accum_term.intersection(&incompat_term.negate());
489-
let out = satisfier_pa.satisfier(satisfier_package, &start_term);
490-
491488
satisfied_map.insert(
492489
satisfier_package,
493490
if accum_term.subset_of(incompat_term) {
494491
(None, 0, DecisionLevel(1))
495492
} else {
496-
out
493+
satisfier_pa.satisfier(
494+
satisfier_package,
495+
&accum_term.intersection(&incompat_term.negate()),
496+
)
497497
},
498498
);
499499

@@ -516,14 +516,16 @@ impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> PackageAssignm
516516
package: &P,
517517
start_term: &Term<VS>,
518518
) -> (Option<IncompId<P, VS, M>>, u32, DecisionLevel) {
519-
let empty = Term::empty();
520519
// Indicate if we found a satisfier in the list of derivations, otherwise it will be the decision.
521520
let idx = self
522521
.dated_derivations
523522
.as_slice()
524523
.partition_point(|dd| !dd.accumulated_intersection.is_disjoint(start_term));
525524
if let Some(dd) = self.dated_derivations.get(idx) {
526-
debug_assert_eq!(dd.accumulated_intersection.intersection(start_term), empty);
525+
debug_assert_eq!(
526+
dd.accumulated_intersection.intersection(start_term),
527+
Term::empty()
528+
);
527529
return (Some(dd.cause), dd.global_index, dd.decision_level);
528530
}
529531
// If it wasn't found in the derivations,

0 commit comments

Comments
 (0)