Skip to content

Commit

Permalink
fix: Avoid the dashmap being cloned for each thread (#67)
Browse files Browse the repository at this point in the history
Intead, share it by reference, it's sync after all.

This issue was introduced when switching to a `Send + Clone` model,
instead of `Send + Sync`, to allow thread-local caches in database
handles of all kinds.
  • Loading branch information
Byron committed Dec 6, 2021
1 parent bcb3d37 commit 6d3f52d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 4 additions & 3 deletions git-pack/src/data/output/count/objects/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,18 @@ where
}
},
{
let seen_objs = &seen_objs;
move |oids: Vec<std::result::Result<Oid, IterErr>>, (buf1, buf2, progress)| {
expand::this(
&db,
input_object_expansion,
&seen_objs,
seen_objs,
oids,
buf1,
buf2,
progress,
should_interrupt,
true,
true, /*allow pack lookups*/
)
}
},
Expand Down Expand Up @@ -129,7 +130,7 @@ where
&mut buf2,
&mut progress,
should_interrupt,
false,
false, /*allow pack lookups*/
)
}

Expand Down
3 changes: 1 addition & 2 deletions gitoxide-core/src/pack/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ where
let counts = {
let mut progress = progress.add_child("counting");
progress.init(None, progress::count("objects"));
let may_use_multiple_threads = (nondeterministic_count || matches!(expansion, ObjectExpansion::None))
&& !matches!(expansion, ObjectExpansion::TreeDiff);
let may_use_multiple_threads = nondeterministic_count || matches!(expansion, ObjectExpansion::None);
let thread_limit = if may_use_multiple_threads {
thread_limit
} else {
Expand Down

0 comments on commit 6d3f52d

Please sign in to comment.