Skip to content

Commit c270f78

Browse files
committed
Merge branch 'parallel-feature'
2 parents 53bbd06 + 2734e84 commit c270f78

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

gix/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ blocking-http-transport-reqwest-native-tls = ["blocking-http-transport-reqwest",
133133
## Activate features that maximize performance, like usage of threads, `zlib-ng` and access to caching in object databases, skipping the ones known to cause compile failures
134134
## on some platforms.
135135
max-performance-safe = [
136-
"gix-features/parallel",
136+
"parallel",
137137
"pack-cache-lru-static",
138138
"pack-cache-lru-dynamic",
139139
"gix-features/fs-walkdir-parallel"
@@ -144,6 +144,11 @@ max-performance-safe = [
144144
## the simpler implementation that is the default.
145145
hp-tempfile-registry = ["gix-tempfile/hp-hashmap"]
146146

147+
## Make certain data structure threadsafe (or `Sync`) to facilitate multithreading. Further, many algorithms will now use multiple threads by default.
148+
##
149+
## If unset, most of `gix` can only be used in a single thread as data structures won't be `Send` anymore.
150+
parallel = ["gix-features/parallel"]
151+
147152
## Provide a fixed-size allocation-free LRU cache for packs. It's useful if caching is desired while keeping the memory footprint
148153
## for the LRU-cache itself low.
149154
pack-cache-lru-static = ["gix-pack/pack-cache-lru-static"]

gix/tests/repository/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::util;
12
use gix::Repository;
23

34
mod config;
@@ -24,3 +25,11 @@ fn size_in_memory() {
2425
"size of Repository shouldn't change without us noticing, it's meant to be cloned: should have been below {limit:?}, was {actual_size} (bigger on windows)"
2526
);
2627
}
28+
29+
#[test]
30+
#[cfg(feature = "parallel")]
31+
fn thread_safe_repository_is_sync() -> crate::Result {
32+
fn f<T: Send + Sync + Clone>(_t: T) {}
33+
f(util::basic_repo()?.into_sync());
34+
Ok(())
35+
}

0 commit comments

Comments
 (0)