mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 02:04:19 +00:00
index_store: don't look up whole commit when only id is needed
When building an initial index from an existing Git repo, for example, we walk parents and predecessors to find all commits to index. Part of that code was looking up the whole parent and predecessor commits even though it only needed the ids. I don't know if this has a measurable impact on performance, but it's not really any more complex to just get the ids anyway.
This commit is contained in:
parent
be638d0205
commit
2971c45e04
1 changed files with 7 additions and 3 deletions
|
@ -214,10 +214,14 @@ fn topo_order_earlier_first(
|
|||
let mut visited = in_parent_file;
|
||||
while let Some(commit) = commits.pop() {
|
||||
let mut waiting_for_earlier_commit = false;
|
||||
for earlier in commit.parents().iter().chain(commit.predecessors().iter()) {
|
||||
if !visited.contains(earlier.id()) {
|
||||
for earlier in commit
|
||||
.parent_ids()
|
||||
.iter()
|
||||
.chain(commit.predecessor_ids().iter())
|
||||
{
|
||||
if !visited.contains(earlier) {
|
||||
waiting
|
||||
.entry(earlier.id().clone())
|
||||
.entry(earlier.clone())
|
||||
.or_insert_with(Vec::new)
|
||||
.push(commit.clone());
|
||||
waiting_for_earlier_commit = true;
|
||||
|
|
Loading…
Reference in a new issue