Skip to content

Commit

Permalink
higher-performance 'seen' tracking for commit traversal (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Apr 5, 2022
1 parent 514e468 commit 8c530d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions git-traverse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ doctest = false
git-hash = { version = "^0.9.3", path = "../git-hash" }
git-object = { version = "^0.18.0", path = "../git-object" }
quick-error = "2.0.0"
hash_hasher = "2.0.3"

[dev-dependencies]
git-testtools = { path = "../tests/tools" }
Expand Down
7 changes: 2 additions & 5 deletions git-traverse/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ impl Default for Sorting {

///
pub mod ancestors {
use std::{
borrow::BorrowMut,
collections::{BTreeSet, VecDeque},
};
use std::{borrow::BorrowMut, collections::VecDeque};

use git_hash::{oid, ObjectId};
use git_object::CommitRefIter;
Expand Down Expand Up @@ -74,7 +71,7 @@ pub mod ancestors {
pub struct State {
next: VecDeque<ObjectId>,
buf: Vec<u8>,
seen: BTreeSet<ObjectId>,
seen: hash_hasher::HashedSet<ObjectId>,
parents_with_date: Vec<(ObjectId, u32)>,
parents_buf: Vec<u8>,
}
Expand Down

0 comments on commit 8c530d1

Please sign in to comment.