Skip to content

Commit

Permalink
improve performance of commit-graph variant ever-so-slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 26, 2024
1 parent 6fdaafa commit 3d57f82
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions gix-revision/src/merge_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ pub(crate) mod function {
others: &[ObjectId],
graph: &mut Graph<'_, '_, Flags>,
) -> Result<Option<Vec<ObjectId>>, Error> {
let _span = gix_trace::coarse!("gix_revision::merge_base()", ?first, ?others,);
let _span = gix_trace::coarse!("gix_revision::merge_base()",?first,?others);
if others.is_empty() || others.contains(&first) {
return Ok(Some(vec![first]));
}

graph.clear();
let bases = paint_down_to_common(first, others, graph)?;
graph.clear();

Expand All @@ -62,6 +63,7 @@ pub(crate) mod function {
commits: &[(ObjectId, GenThenTime)],
graph: &mut Graph<'_, '_, Flags>,
) -> Result<Vec<ObjectId>, Error> {
let _span = gix_trace::detail!("gix_revision::remove_redundant()", num_commits = %commits.len());
if commits.is_empty() {
return Ok(Vec::new());
}
Expand Down Expand Up @@ -217,11 +219,10 @@ pub(crate) mod function {
type Error = gix_object::decode::Error;

fn try_from(commit: LazyCommit<'_, '_>) -> Result<Self, Self::Error> {
let (generation, timestamp) = commit.generation_and_timestamp()?;
Ok(GenThenTime {
generation: commit
.generation()
.unwrap_or(gix_commitgraph::GENERATION_NUMBER_INFINITY),
time: commit.committer_timestamp()?,
generation: generation.unwrap_or(gix_commitgraph::GENERATION_NUMBER_INFINITY),
time: timestamp,
})
}
}
Expand Down

0 comments on commit 3d57f82

Please sign in to comment.