Skip to content

Commit

Permalink
Add cold annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
x-hgg-x committed Nov 22, 2024
1 parent 4ac6c42 commit f0e4262
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 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
3 changes: 0 additions & 3 deletions src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ impl<P: Package, VS: VersionSet> DependencyProvider for OfflineDependencyProvide

type Err = Infallible;

#[inline]
fn choose_version(&self, package: &P, range: &VS) -> Result<Option<VS::V>, Infallible> {
Ok(self
.dependencies
Expand All @@ -94,7 +93,6 @@ impl<P: Package, VS: VersionSet> DependencyProvider for OfflineDependencyProvide

type Priority = Reverse<usize>;

#[inline]
fn prioritize(&self, package: &P, range: &VS) -> Self::Priority {
Reverse(
self.dependencies
Expand All @@ -104,7 +102,6 @@ impl<P: Package, VS: VersionSet> DependencyProvider for OfflineDependencyProvide
)
}

#[inline]
fn get_dependencies(
&self,
package: &P,
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 f0e4262

Please sign in to comment.