pub struct Repository { /* private fields */ }Implementations§
Source§impl Repository
impl Repository
pub fn multi_pack_index_count(&self) -> usize
pub fn commit_graph_layer_count(&self) -> usize
pub fn commit_maybe_changed_path( &self, id: ObjectId, path: impl AsRef<[u8]>, ) -> Result<Option<PathBloom>>
Sourcepub fn bitmap_reachable(
&self,
commit: ObjectId,
) -> Result<Option<Vec<ObjectId>>>
pub fn bitmap_reachable( &self, commit: ObjectId, ) -> Result<Option<Vec<ObjectId>>>
Examples found in repository?
examples/benchmark_storage.rs (line 24)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let args = env::args().skip(1).collect::<Vec<_>>();
13 let path = args.first().map_or(".", String::as_str);
14 let iterations = args
15 .get(1)
16 .map(|value| value.parse())
17 .transpose()?
18 .unwrap_or(50);
19 let repository = Repository::open(path)?;
20 let head = repository.resolve("HEAD")?;
21
22 let expected_objects = git_object_ids(path)?;
23 let actual_objects = repository
24 .bitmap_reachable(head)?
25 .ok_or("repository has no reachability bitmap")?
26 .into_iter()
27 .map(|id| id.to_string())
28 .collect::<BTreeSet<_>>();
29 if actual_objects != expected_objects {
30 return Err("bitmap reachability differs from git rev-list --objects".into());
31 }
32 let expected_paths = git_paths(path)?;
33 let actual_paths = repository
34 .index()?
35 .entries()
36 .iter()
37 .map(|entry| entry.path.clone())
38 .collect::<Vec<_>>();
39 if actual_paths != expected_paths {
40 return Err("index paths differ from git ls-files".into());
41 }
42 let expected_status = git_status(path)?;
43 let actual_status = repository.status()?;
44 if !expected_status.is_empty() || !actual_status.is_empty() {
45 return Err(format!(
46 "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47 expected_status.len()
48 )
49 .into());
50 }
51
52 println!("operation,engine,p50_ms,p95_ms,items");
53 row(
54 "reachability",
55 "weavatrix-git",
56 &measure(iterations, || {
57 repository
58 .bitmap_reachable(head)
59 .map(|value| value.map_or(0, |ids| ids.len()))
60 })?,
61 actual_objects.len(),
62 );
63 row(
64 "reachability",
65 "git.exe",
66 &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67 expected_objects.len(),
68 );
69 row(
70 "index",
71 "weavatrix-git",
72 &measure(iterations, || {
73 repository.index().map(|index| index.entries().len())
74 })?,
75 actual_paths.len(),
76 );
77 row(
78 "index",
79 "git.exe",
80 &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81 expected_paths.len(),
82 );
83 row(
84 "tracked-status",
85 "weavatrix-git",
86 &measure(iterations, || {
87 repository.status().map(|entries| entries.len())
88 })?,
89 0,
90 );
91 row(
92 "tracked-status",
93 "git.exe",
94 &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95 0,
96 );
97 row(
98 "cached-commit",
99 "weavatrix-git",
100 &measure(iterations, || repository.commit(head).map(|_| 1))?,
101 1,
102 );
103 row(
104 "cached-commit",
105 "git.exe",
106 &measure(iterations, || git_exists(path, &head.to_string()))?,
107 1,
108 );
109 Ok(())
110}pub fn objects_parallel(&self, ids: &[ObjectId]) -> Vec<Result<Object>> ⓘ
pub fn commit_metadata_parallel( &self, ids: &[ObjectId], ) -> Vec<Result<CommitMetadata>> ⓘ
Source§impl Repository
impl Repository
Sourcepub fn index(&self) -> Result<Index>
pub fn index(&self) -> Result<Index>
Examples found in repository?
examples/benchmark_storage.rs (line 34)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let args = env::args().skip(1).collect::<Vec<_>>();
13 let path = args.first().map_or(".", String::as_str);
14 let iterations = args
15 .get(1)
16 .map(|value| value.parse())
17 .transpose()?
18 .unwrap_or(50);
19 let repository = Repository::open(path)?;
20 let head = repository.resolve("HEAD")?;
21
22 let expected_objects = git_object_ids(path)?;
23 let actual_objects = repository
24 .bitmap_reachable(head)?
25 .ok_or("repository has no reachability bitmap")?
26 .into_iter()
27 .map(|id| id.to_string())
28 .collect::<BTreeSet<_>>();
29 if actual_objects != expected_objects {
30 return Err("bitmap reachability differs from git rev-list --objects".into());
31 }
32 let expected_paths = git_paths(path)?;
33 let actual_paths = repository
34 .index()?
35 .entries()
36 .iter()
37 .map(|entry| entry.path.clone())
38 .collect::<Vec<_>>();
39 if actual_paths != expected_paths {
40 return Err("index paths differ from git ls-files".into());
41 }
42 let expected_status = git_status(path)?;
43 let actual_status = repository.status()?;
44 if !expected_status.is_empty() || !actual_status.is_empty() {
45 return Err(format!(
46 "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47 expected_status.len()
48 )
49 .into());
50 }
51
52 println!("operation,engine,p50_ms,p95_ms,items");
53 row(
54 "reachability",
55 "weavatrix-git",
56 &measure(iterations, || {
57 repository
58 .bitmap_reachable(head)
59 .map(|value| value.map_or(0, |ids| ids.len()))
60 })?,
61 actual_objects.len(),
62 );
63 row(
64 "reachability",
65 "git.exe",
66 &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67 expected_objects.len(),
68 );
69 row(
70 "index",
71 "weavatrix-git",
72 &measure(iterations, || {
73 repository.index().map(|index| index.entries().len())
74 })?,
75 actual_paths.len(),
76 );
77 row(
78 "index",
79 "git.exe",
80 &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81 expected_paths.len(),
82 );
83 row(
84 "tracked-status",
85 "weavatrix-git",
86 &measure(iterations, || {
87 repository.status().map(|entries| entries.len())
88 })?,
89 0,
90 );
91 row(
92 "tracked-status",
93 "git.exe",
94 &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95 0,
96 );
97 row(
98 "cached-commit",
99 "weavatrix-git",
100 &measure(iterations, || repository.commit(head).map(|_| 1))?,
101 1,
102 );
103 row(
104 "cached-commit",
105 "git.exe",
106 &measure(iterations, || git_exists(path, &head.to_string()))?,
107 1,
108 );
109 Ok(())
110}Source§impl Repository
impl Repository
Source§impl Repository
impl Repository
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Examples found in repository?
examples/benchmark.rs (line 16)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11 let args = env::args().skip(1).collect::<Vec<_>>();
12 let path = args.first().map_or(".", String::as_str);
13 let max_count = parse(&args, 1, 500)?;
14 let iterations = parse(&args, 2, 20)?;
15 let expected = git_ids(path, max_count)?;
16 let repository = Repository::open(path)?;
17 let start = repository.resolve("HEAD")?;
18 let options = HistoryOptions {
19 max_commits: max_count,
20 first_parent: true,
21 ..HistoryOptions::default()
22 };
23 let actual = repository
24 .history_ids(start, options)?
25 .into_iter()
26 .map(|id| id.to_string())
27 .collect::<Vec<_>>();
28 if actual != expected {
29 return Err("history identifiers differ from git rev-list".into());
30 }
31
32 let warm = measure(iterations, || {
33 repository
34 .history_ids(start, options)
35 .map(|identifiers| identifiers.len())
36 })?;
37 let reopen = measure(iterations, || {
38 let repo = Repository::open(path)?;
39 repo.history_ids(repo.resolve("HEAD")?, options)
40 .map(|identifiers| identifiers.len())
41 })?;
42 let git = measure(iterations, || git_ids(path, max_count).map(|ids| ids.len()))?;
43 println!("engine,mode,p50_ms,p95_ms,commits");
44 print_row("weavatrix-git", "warm", &warm, actual.len());
45 print_row("weavatrix-git", "reopen", &reopen, actual.len());
46 print_row("git.exe", "process", &git, expected.len());
47 Ok(())
48}More examples
examples/benchmark_storage.rs (line 19)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let args = env::args().skip(1).collect::<Vec<_>>();
13 let path = args.first().map_or(".", String::as_str);
14 let iterations = args
15 .get(1)
16 .map(|value| value.parse())
17 .transpose()?
18 .unwrap_or(50);
19 let repository = Repository::open(path)?;
20 let head = repository.resolve("HEAD")?;
21
22 let expected_objects = git_object_ids(path)?;
23 let actual_objects = repository
24 .bitmap_reachable(head)?
25 .ok_or("repository has no reachability bitmap")?
26 .into_iter()
27 .map(|id| id.to_string())
28 .collect::<BTreeSet<_>>();
29 if actual_objects != expected_objects {
30 return Err("bitmap reachability differs from git rev-list --objects".into());
31 }
32 let expected_paths = git_paths(path)?;
33 let actual_paths = repository
34 .index()?
35 .entries()
36 .iter()
37 .map(|entry| entry.path.clone())
38 .collect::<Vec<_>>();
39 if actual_paths != expected_paths {
40 return Err("index paths differ from git ls-files".into());
41 }
42 let expected_status = git_status(path)?;
43 let actual_status = repository.status()?;
44 if !expected_status.is_empty() || !actual_status.is_empty() {
45 return Err(format!(
46 "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47 expected_status.len()
48 )
49 .into());
50 }
51
52 println!("operation,engine,p50_ms,p95_ms,items");
53 row(
54 "reachability",
55 "weavatrix-git",
56 &measure(iterations, || {
57 repository
58 .bitmap_reachable(head)
59 .map(|value| value.map_or(0, |ids| ids.len()))
60 })?,
61 actual_objects.len(),
62 );
63 row(
64 "reachability",
65 "git.exe",
66 &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67 expected_objects.len(),
68 );
69 row(
70 "index",
71 "weavatrix-git",
72 &measure(iterations, || {
73 repository.index().map(|index| index.entries().len())
74 })?,
75 actual_paths.len(),
76 );
77 row(
78 "index",
79 "git.exe",
80 &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81 expected_paths.len(),
82 );
83 row(
84 "tracked-status",
85 "weavatrix-git",
86 &measure(iterations, || {
87 repository.status().map(|entries| entries.len())
88 })?,
89 0,
90 );
91 row(
92 "tracked-status",
93 "git.exe",
94 &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95 0,
96 );
97 row(
98 "cached-commit",
99 "weavatrix-git",
100 &measure(iterations, || repository.commit(head).map(|_| 1))?,
101 1,
102 );
103 row(
104 "cached-commit",
105 "git.exe",
106 &measure(iterations, || git_exists(path, &head.to_string()))?,
107 1,
108 );
109 Ok(())
110}pub fn open_with_limits(path: impl AsRef<Path>, limits: Limits) -> Result<Self>
pub fn open_with_backends( path: impl AsRef<Path>, limits: Limits, backends: Vec<Arc<dyn ObjectBackend>>, ) -> Result<Self>
pub fn work_dir(&self) -> Option<&Path>
pub fn git_dir(&self) -> &Path
pub fn common_dir(&self) -> &Path
pub const fn hash_kind(&self) -> HashKind
pub const fn limits(&self) -> &Limits
pub fn pack_count(&self) -> usize
pub fn head(&self) -> Result<Head>
pub fn reference(&self, name: &str) -> Result<Reference>
Sourcepub fn resolve(&self, value: &str) -> Result<ObjectId>
pub fn resolve(&self, value: &str) -> Result<ObjectId>
Examples found in repository?
examples/benchmark.rs (line 17)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11 let args = env::args().skip(1).collect::<Vec<_>>();
12 let path = args.first().map_or(".", String::as_str);
13 let max_count = parse(&args, 1, 500)?;
14 let iterations = parse(&args, 2, 20)?;
15 let expected = git_ids(path, max_count)?;
16 let repository = Repository::open(path)?;
17 let start = repository.resolve("HEAD")?;
18 let options = HistoryOptions {
19 max_commits: max_count,
20 first_parent: true,
21 ..HistoryOptions::default()
22 };
23 let actual = repository
24 .history_ids(start, options)?
25 .into_iter()
26 .map(|id| id.to_string())
27 .collect::<Vec<_>>();
28 if actual != expected {
29 return Err("history identifiers differ from git rev-list".into());
30 }
31
32 let warm = measure(iterations, || {
33 repository
34 .history_ids(start, options)
35 .map(|identifiers| identifiers.len())
36 })?;
37 let reopen = measure(iterations, || {
38 let repo = Repository::open(path)?;
39 repo.history_ids(repo.resolve("HEAD")?, options)
40 .map(|identifiers| identifiers.len())
41 })?;
42 let git = measure(iterations, || git_ids(path, max_count).map(|ids| ids.len()))?;
43 println!("engine,mode,p50_ms,p95_ms,commits");
44 print_row("weavatrix-git", "warm", &warm, actual.len());
45 print_row("weavatrix-git", "reopen", &reopen, actual.len());
46 print_row("git.exe", "process", &git, expected.len());
47 Ok(())
48}More examples
examples/benchmark_storage.rs (line 20)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let args = env::args().skip(1).collect::<Vec<_>>();
13 let path = args.first().map_or(".", String::as_str);
14 let iterations = args
15 .get(1)
16 .map(|value| value.parse())
17 .transpose()?
18 .unwrap_or(50);
19 let repository = Repository::open(path)?;
20 let head = repository.resolve("HEAD")?;
21
22 let expected_objects = git_object_ids(path)?;
23 let actual_objects = repository
24 .bitmap_reachable(head)?
25 .ok_or("repository has no reachability bitmap")?
26 .into_iter()
27 .map(|id| id.to_string())
28 .collect::<BTreeSet<_>>();
29 if actual_objects != expected_objects {
30 return Err("bitmap reachability differs from git rev-list --objects".into());
31 }
32 let expected_paths = git_paths(path)?;
33 let actual_paths = repository
34 .index()?
35 .entries()
36 .iter()
37 .map(|entry| entry.path.clone())
38 .collect::<Vec<_>>();
39 if actual_paths != expected_paths {
40 return Err("index paths differ from git ls-files".into());
41 }
42 let expected_status = git_status(path)?;
43 let actual_status = repository.status()?;
44 if !expected_status.is_empty() || !actual_status.is_empty() {
45 return Err(format!(
46 "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47 expected_status.len()
48 )
49 .into());
50 }
51
52 println!("operation,engine,p50_ms,p95_ms,items");
53 row(
54 "reachability",
55 "weavatrix-git",
56 &measure(iterations, || {
57 repository
58 .bitmap_reachable(head)
59 .map(|value| value.map_or(0, |ids| ids.len()))
60 })?,
61 actual_objects.len(),
62 );
63 row(
64 "reachability",
65 "git.exe",
66 &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67 expected_objects.len(),
68 );
69 row(
70 "index",
71 "weavatrix-git",
72 &measure(iterations, || {
73 repository.index().map(|index| index.entries().len())
74 })?,
75 actual_paths.len(),
76 );
77 row(
78 "index",
79 "git.exe",
80 &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81 expected_paths.len(),
82 );
83 row(
84 "tracked-status",
85 "weavatrix-git",
86 &measure(iterations, || {
87 repository.status().map(|entries| entries.len())
88 })?,
89 0,
90 );
91 row(
92 "tracked-status",
93 "git.exe",
94 &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95 0,
96 );
97 row(
98 "cached-commit",
99 "weavatrix-git",
100 &measure(iterations, || repository.commit(head).map(|_| 1))?,
101 1,
102 );
103 row(
104 "cached-commit",
105 "git.exe",
106 &measure(iterations, || git_exists(path, &head.to_string()))?,
107 1,
108 );
109 Ok(())
110}pub fn object(&self, id: ObjectId) -> Result<Object>
pub fn contains(&self, id: ObjectId) -> bool
pub fn contains_checked(&self, id: ObjectId) -> Result<bool>
Sourcepub fn commit(&self, id: ObjectId) -> Result<Commit>
pub fn commit(&self, id: ObjectId) -> Result<Commit>
Examples found in repository?
examples/benchmark_storage.rs (line 100)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let args = env::args().skip(1).collect::<Vec<_>>();
13 let path = args.first().map_or(".", String::as_str);
14 let iterations = args
15 .get(1)
16 .map(|value| value.parse())
17 .transpose()?
18 .unwrap_or(50);
19 let repository = Repository::open(path)?;
20 let head = repository.resolve("HEAD")?;
21
22 let expected_objects = git_object_ids(path)?;
23 let actual_objects = repository
24 .bitmap_reachable(head)?
25 .ok_or("repository has no reachability bitmap")?
26 .into_iter()
27 .map(|id| id.to_string())
28 .collect::<BTreeSet<_>>();
29 if actual_objects != expected_objects {
30 return Err("bitmap reachability differs from git rev-list --objects".into());
31 }
32 let expected_paths = git_paths(path)?;
33 let actual_paths = repository
34 .index()?
35 .entries()
36 .iter()
37 .map(|entry| entry.path.clone())
38 .collect::<Vec<_>>();
39 if actual_paths != expected_paths {
40 return Err("index paths differ from git ls-files".into());
41 }
42 let expected_status = git_status(path)?;
43 let actual_status = repository.status()?;
44 if !expected_status.is_empty() || !actual_status.is_empty() {
45 return Err(format!(
46 "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47 expected_status.len()
48 )
49 .into());
50 }
51
52 println!("operation,engine,p50_ms,p95_ms,items");
53 row(
54 "reachability",
55 "weavatrix-git",
56 &measure(iterations, || {
57 repository
58 .bitmap_reachable(head)
59 .map(|value| value.map_or(0, |ids| ids.len()))
60 })?,
61 actual_objects.len(),
62 );
63 row(
64 "reachability",
65 "git.exe",
66 &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67 expected_objects.len(),
68 );
69 row(
70 "index",
71 "weavatrix-git",
72 &measure(iterations, || {
73 repository.index().map(|index| index.entries().len())
74 })?,
75 actual_paths.len(),
76 );
77 row(
78 "index",
79 "git.exe",
80 &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81 expected_paths.len(),
82 );
83 row(
84 "tracked-status",
85 "weavatrix-git",
86 &measure(iterations, || {
87 repository.status().map(|entries| entries.len())
88 })?,
89 0,
90 );
91 row(
92 "tracked-status",
93 "git.exe",
94 &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95 0,
96 );
97 row(
98 "cached-commit",
99 "weavatrix-git",
100 &measure(iterations, || repository.commit(head).map(|_| 1))?,
101 1,
102 );
103 row(
104 "cached-commit",
105 "git.exe",
106 &measure(iterations, || git_exists(path, &head.to_string()))?,
107 1,
108 );
109 Ok(())
110}pub fn commit_metadata(&self, id: ObjectId) -> Result<CommitMetadata>
pub fn tree(&self, id: ObjectId) -> Result<Tree>
pub fn tag(&self, id: ObjectId) -> Result<Tag>
pub fn history( &self, start: ObjectId, options: HistoryOptions, ) -> Result<Vec<HistoryRecord>>
Sourcepub fn history_ids(
&self,
start: ObjectId,
options: HistoryOptions,
) -> Result<Vec<ObjectId>>
pub fn history_ids( &self, start: ObjectId, options: HistoryOptions, ) -> Result<Vec<ObjectId>>
Examples found in repository?
examples/benchmark.rs (line 24)
10fn main() -> Result<(), Box<dyn std::error::Error>> {
11 let args = env::args().skip(1).collect::<Vec<_>>();
12 let path = args.first().map_or(".", String::as_str);
13 let max_count = parse(&args, 1, 500)?;
14 let iterations = parse(&args, 2, 20)?;
15 let expected = git_ids(path, max_count)?;
16 let repository = Repository::open(path)?;
17 let start = repository.resolve("HEAD")?;
18 let options = HistoryOptions {
19 max_commits: max_count,
20 first_parent: true,
21 ..HistoryOptions::default()
22 };
23 let actual = repository
24 .history_ids(start, options)?
25 .into_iter()
26 .map(|id| id.to_string())
27 .collect::<Vec<_>>();
28 if actual != expected {
29 return Err("history identifiers differ from git rev-list".into());
30 }
31
32 let warm = measure(iterations, || {
33 repository
34 .history_ids(start, options)
35 .map(|identifiers| identifiers.len())
36 })?;
37 let reopen = measure(iterations, || {
38 let repo = Repository::open(path)?;
39 repo.history_ids(repo.resolve("HEAD")?, options)
40 .map(|identifiers| identifiers.len())
41 })?;
42 let git = measure(iterations, || git_ids(path, max_count).map(|ids| ids.len()))?;
43 println!("engine,mode,p50_ms,p95_ms,commits");
44 print_row("weavatrix-git", "warm", &warm, actual.len());
45 print_row("weavatrix-git", "reopen", &reopen, actual.len());
46 print_row("git.exe", "process", &git, expected.len());
47 Ok(())
48}pub fn diff_trees( &self, old: ObjectId, new: ObjectId, ) -> Result<Vec<TreeChange>>
pub fn diff_commits( &self, old: ObjectId, new: ObjectId, ) -> Result<Vec<TreeChange>>
Source§impl Repository
impl Repository
pub fn snapshot(&self, revision: &str) -> Result<CommitSnapshot>
pub fn tree_manifest(&self, tree: ObjectId) -> Result<Vec<SnapshotEntry>>
Source§impl Repository
impl Repository
Sourcepub fn status(&self) -> Result<Vec<StatusEntry>>
pub fn status(&self) -> Result<Vec<StatusEntry>>
Examples found in repository?
examples/benchmark_storage.rs (line 43)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let args = env::args().skip(1).collect::<Vec<_>>();
13 let path = args.first().map_or(".", String::as_str);
14 let iterations = args
15 .get(1)
16 .map(|value| value.parse())
17 .transpose()?
18 .unwrap_or(50);
19 let repository = Repository::open(path)?;
20 let head = repository.resolve("HEAD")?;
21
22 let expected_objects = git_object_ids(path)?;
23 let actual_objects = repository
24 .bitmap_reachable(head)?
25 .ok_or("repository has no reachability bitmap")?
26 .into_iter()
27 .map(|id| id.to_string())
28 .collect::<BTreeSet<_>>();
29 if actual_objects != expected_objects {
30 return Err("bitmap reachability differs from git rev-list --objects".into());
31 }
32 let expected_paths = git_paths(path)?;
33 let actual_paths = repository
34 .index()?
35 .entries()
36 .iter()
37 .map(|entry| entry.path.clone())
38 .collect::<Vec<_>>();
39 if actual_paths != expected_paths {
40 return Err("index paths differ from git ls-files".into());
41 }
42 let expected_status = git_status(path)?;
43 let actual_status = repository.status()?;
44 if !expected_status.is_empty() || !actual_status.is_empty() {
45 return Err(format!(
46 "status benchmark requires a clean tracked worktree (git={} bytes, weavatrix={actual_status:?})",
47 expected_status.len()
48 )
49 .into());
50 }
51
52 println!("operation,engine,p50_ms,p95_ms,items");
53 row(
54 "reachability",
55 "weavatrix-git",
56 &measure(iterations, || {
57 repository
58 .bitmap_reachable(head)
59 .map(|value| value.map_or(0, |ids| ids.len()))
60 })?,
61 actual_objects.len(),
62 );
63 row(
64 "reachability",
65 "git.exe",
66 &measure(iterations, || git_object_ids(path).map(|ids| ids.len()))?,
67 expected_objects.len(),
68 );
69 row(
70 "index",
71 "weavatrix-git",
72 &measure(iterations, || {
73 repository.index().map(|index| index.entries().len())
74 })?,
75 actual_paths.len(),
76 );
77 row(
78 "index",
79 "git.exe",
80 &measure(iterations, || git_paths(path).map(|paths| paths.len()))?,
81 expected_paths.len(),
82 );
83 row(
84 "tracked-status",
85 "weavatrix-git",
86 &measure(iterations, || {
87 repository.status().map(|entries| entries.len())
88 })?,
89 0,
90 );
91 row(
92 "tracked-status",
93 "git.exe",
94 &measure(iterations, || git_status(path).map(|entries| entries.len()))?,
95 0,
96 );
97 row(
98 "cached-commit",
99 "weavatrix-git",
100 &measure(iterations, || repository.commit(head).map(|_| 1))?,
101 1,
102 );
103 row(
104 "cached-commit",
105 "git.exe",
106 &measure(iterations, || git_exists(path, &head.to_string()))?,
107 1,
108 );
109 Ok(())
110}Source§impl Repository
impl Repository
Auto Trait Implementations§
impl !Freeze for Repository
impl !RefUnwindSafe for Repository
impl !UnwindSafe for Repository
impl Send for Repository
impl Sync for Repository
impl Unpin for Repository
impl UnsafeUnpin for Repository
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more