Skip to content

Commit 6fea17d

Browse files
committed
Frame for using the new 'scoped threads' feature in git-features (#293)
1 parent ca095ed commit 6fea17d

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

git-index/src/decode/mod.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,28 @@ impl State {
6868
Some(offset) if num_threads > 1 => {
6969
let start_of_extensions = &data[offset..];
7070
let index_offsets_table = extension::index_entry_offset_table::find(start_of_extensions, object_hash);
71-
let (entries_res, (ext, data)) = match index_offsets_table {
72-
Some(entry_offsets) => {
73-
dbg!(entry_offsets);
74-
todo!("threaded entry loading if its worth it")
75-
}
76-
None => {
77-
git_features::parallel::join(
71+
let (entries_res, (ext, data)) = git_features::parallel::threads(|_scope| {
72+
match index_offsets_table {
73+
Some(entry_offsets) => {
74+
dbg!(entry_offsets);
75+
todo!("threaded entry loading if its worth it")
76+
}
77+
None => {
7878
// TODO load all extensions in scoped, then get IEOT, then possibly multi-threaded entry parsing
79-
|| {
79+
(
8080
entries::load_all(
8181
post_header_data,
8282
num_entries,
8383
path_backing_buffer_size,
8484
object_hash,
8585
version,
86-
)
87-
},
88-
|| extension::decode::all(start_of_extensions, object_hash),
89-
)
86+
),
87+
extension::decode::all(start_of_extensions, object_hash),
88+
)
89+
}
9090
}
91-
};
91+
})
92+
.unwrap(); // this unwrap is for panics - if these happened we are done anyway.
9293
(entries_res?.0, ext, data)
9394
}
9495
None | Some(_) => {

git-index/tests/index/file/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ mod init {
3636
fn read_without_any_extension() {}
3737

3838
#[test]
39-
#[ignore]
4039
fn read_v4_with_delta_paths_and_ieot_ext() {
4140
let file = file("v4_more_files_IEOT");
4241
assert_eq!(file.version(), Version::V4);

0 commit comments

Comments
 (0)