Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: remove redundant scanning #175

Merged
merged 5 commits into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/internal/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,14 @@ impl<P: Package, VS: VersionSet, Priority: Ord + Clone> State<P, VS, Priority> {
break;
}
Relation::AlmostSatisfied(package_almost) => {
self.unit_propagation_buffer.push(package_almost.clone());
// Add `package_almost` to the `unit_propagation_buffer` set.
// Putting items in `unit_propagation_buffer` more than once waste cycles,
// but so does checking for duplicates.
// In practice the most common pathology is adding the same package repeatedly.
// So we only check if it is duplicated with the last item.
if self.unit_propagation_buffer.last() != Some(&package_almost) {
self.unit_propagation_buffer.push(package_almost.clone());
}
// Add (not term) to the partial solution with incompat as cause.
self.partial_solution.add_derivation(
package_almost,
Expand Down