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
3636 p.init(Some(self.num_objects()), Some("objects"));
3737 p
3838 });
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+ };
3947 in_parallel_if(
4048 if_there_are_enough_objects,
4149 tree.bases(),
4250 thread_limit,
43− |_index| (),
44− |_node: pack::graph::Node, _state: &mut ()| Ok::<_, Error>(Vec::new()),
51+ state_per_thread,
52+ |_node: pack::graph::Node, (_buf, _encode_buf, _progress)| Ok::<_, Error>(Vec::new()),
4553 index::verify::Reducer::from_progress(&reduce_progress, pack.data_len()),
4654 )
4755 }
git-odb/src/pack/index/verify/lookup.rs+4−6
@@ -35,9 +35,9 @@ impl index::File { · 34 unmodified lines
3535 let state_per_thread = |index| {
3636 (
3737 make_cache(),
38− Vec::with_capacity(2048),
39− Vec::with_capacity(2048),
40− reduce_progress.lock().unwrap().add_child(format!("thread {}", index)),
38+ Vec::with_capacity(2048), // decode buffer
39+ Vec::with_capacity(2048), // re-encode buffer
40+ reduce_progress.lock().unwrap().add_child(format!("thread {}", index)), // per thread progress
4141 )
4242 };
4343
@@ -46,9 +46,7 @@ impl index::File { · 2 unmodified lines
4646 input_chunks,
4747 thread_limit,
4848 state_per_thread,
49− |entries: &[index::Entry],
50− (cache, buf, ref mut encode_buf, progress)|
51− -> Result<Vec<decode::Outcome>, Error> {
49+ |entries: &[index::Entry], (cache, buf, encode_buf, progress)| -> Result<Vec<decode::Outcome>, Error> {
5250 progress.init(Some(entries.len() as u32), Some("entries"));
5351 let mut stats = Vec::with_capacity(entries.len());
5452 let mut header_buf = [0u8; 64];