File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -128,10 +128,9 @@ impl<DP: DependencyProvider> State<DP> {
128
128
Relation :: AlmostSatisfied ( package_almost) => {
129
129
// Add `package_almost` to the `unit_propagation_buffer` set.
130
130
// Putting items in `unit_propagation_buffer` more than once waste cycles,
131
- // but so does checking for duplicates.
132
- // In practice the most common pathology is adding the same package repeatedly.
133
- // So we only check if it is duplicated with the last item.
134
- if self . unit_propagation_buffer . last ( ) != Some ( & package_almost) {
131
+ // but so does allocating a hash map and hashing each item.
132
+ // In practice `unit_propagation_buffer` is small enough that we can just do a linear scan.
133
+ if !self . unit_propagation_buffer . contains ( & package_almost) {
135
134
self . unit_propagation_buffer . push ( package_almost. clone ( ) ) ;
136
135
}
137
136
// Add (not term) to the partial solution with incompat as cause.
You can’t perform that action at this time.
0 commit comments