Skip to content

Commit

Permalink
Add cold annotations (pubgrub-rs#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
x-hgg-x authored Nov 22, 2024
1 parent 4ac6c42 commit 4c6cdde
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/internal/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ impl<DP: DependencyProvider> State<DP> {
}

/// Add an incompatibility to the state.
#[cold]
pub(crate) fn add_incompatibility_from_dependencies(
&mut self,
package: Id<DP::P>,
Expand All @@ -105,6 +106,7 @@ impl<DP: DependencyProvider> State<DP> {

/// Unit propagation is the core mechanism of the solving algorithm.
/// CF <https://github.com/dart-lang/pub/blob/master/doc/solver.md#unit-propagation>
#[cold]
pub(crate) fn unit_propagation(
&mut self,
package: Id<DP::P>,
Expand Down Expand Up @@ -187,6 +189,7 @@ impl<DP: DependencyProvider> State<DP> {
/// Return the root cause or the terminal incompatibility.
/// CF <https://github.com/dart-lang/pub/blob/master/doc/solver.md#unit-propagation>
#[allow(clippy::type_complexity)]
#[cold]
fn conflict_resolution(
&mut self,
incompatibility: IncompDpId<DP>,
Expand Down
1 change: 1 addition & 0 deletions src/internal/partial_solution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ impl<DP: DependencyProvider> PartialSolution<DP> {
}
}

#[cold]
pub(crate) fn pick_highest_priority_pkg(
&mut self,
prioritizer: impl Fn(Id<DP::P>, &DP::VS) -> DP::Priority,
Expand Down
1 change: 1 addition & 0 deletions src/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ use crate::{DependencyConstraints, Map, Package, PubGrubError, SelectedDependenc

/// Main function of the library.
/// Finds a set of packages satisfying dependency bounds for a given package + version pair.
#[cold]
pub fn resolve<DP: DependencyProvider>(
dependency_provider: &DP,
package: DP::P,
Expand Down

0 comments on commit 4c6cdde

Please sign in to comment.