History

initial state for indexed lookup

Sebastian Thiel committed 6 years ago

Commit acbcd791 parent 310a2f72 files · +14 −8Browse files

Unified · Split

2 files
  1. git-odb/src/pack/index/verify/indexed.rs +10 −2
  2. git-odb/src/pack/index/verify/lookup.rs +4 −6
git-odb/src/pack/index/verify/indexed.rs+10−2
@@ -36,12 +36,20 @@ impl index::File { · 35 unmodified lines
36 p.init(Some(self.num_objects()), Some("objects"));36 p.init(Some(self.num_objects()), Some("objects"));
37 p37 p
38 });38 });
39
40 let state_per_thread = |index| {
41 (
42 Vec::<u8>::with_capacity(2048), // decode buffer
43 Vec::<u8>::with_capacity(2048), // re-encode buffer
44 reduce_progress.lock().unwrap().add_child(format!("thread {}", index)), // per thread progress
45 )
46 };
39 in_parallel_if(47 in_parallel_if(
40 if_there_are_enough_objects,48 if_there_are_enough_objects,
41 tree.bases(),49 tree.bases(),
42 thread_limit,50 thread_limit,
43 |_index| (),51 state_per_thread,
44 |_node: pack::graph::Node, _state: &mut ()| Ok::<_, Error>(Vec::new()),52 |_node: pack::graph::Node, (_buf, _encode_buf, _progress)| Ok::<_, Error>(Vec::new()),
45 index::verify::Reducer::from_progress(&reduce_progress, pack.data_len()),53 index::verify::Reducer::from_progress(&reduce_progress, pack.data_len()),
46 )54 )
47 }55 }
git-odb/src/pack/index/verify/lookup.rs+4−6
@@ -35,9 +35,9 @@ impl index::File { · 34 unmodified lines
35 let state_per_thread = |index| {35 let state_per_thread = |index| {
36 (36 (
37 make_cache(),37 make_cache(),
38 Vec::with_capacity(2048),38 Vec::with_capacity(2048), // decode buffer
39 Vec::with_capacity(2048),39 Vec::with_capacity(2048), // re-encode buffer
40 reduce_progress.lock().unwrap().add_child(format!("thread {}", index)),40 reduce_progress.lock().unwrap().add_child(format!("thread {}", index)), // per thread progress
41 )41 )
42 };42 };
43 43
@@ -46,9 +46,7 @@ impl index::File { · 2 unmodified lines
46 input_chunks,46 input_chunks,
47 thread_limit,47 thread_limit,
48 state_per_thread,48 state_per_thread,
49 |entries: &[index::Entry],49 |entries: &[index::Entry], (cache, buf, encode_buf, progress)| -> Result<Vec<decode::Outcome>, Error> {
50 (cache, buf, ref mut encode_buf, progress)|
51 -> Result<Vec<decode::Outcome>, Error> {
52 progress.init(Some(entries.len() as u32), Some("entries"));50 progress.init(Some(entries.len() as u32), Some("entries"));
53 let mut stats = Vec::with_capacity(entries.len());51 let mut stats = Vec::with_capacity(entries.len());
54 let mut header_buf = [0u8; 64];52 let mut header_buf = [0u8; 64];