@@ -37,7 +37,7 @@ pub struct Options {
3737 ///
3838 /// This applies to loading extensions in parallel to entries if the common EOIE extension is available.
3939 /// It also allows to use multiple threads for loading entries if the IEOT extension is present.
40- pub num_threads : Option < usize > ,
40+ pub thread_limit : Option < usize > ,
4141 /// The minimum size in bytes to load extensions in their own thread, assuming there is enough `num_threads` available.
4242 pub min_extension_block_in_bytes_for_threading : usize ,
4343}
@@ -48,22 +48,24 @@ impl State {
4848 timestamp : FileTime ,
4949 Options {
5050 object_hash,
51- num_threads : _ ,
51+ thread_limit ,
5252 min_extension_block_in_bytes_for_threading : _,
5353 } : Options ,
5454 ) -> Result < ( Self , git_hash:: ObjectId ) , Error > {
5555 let ( version, num_entries, post_header_data) = header:: decode ( data, object_hash) ?;
5656 let start_of_extensions = extension:: end_of_index_entry:: decode ( data, object_hash) ;
5757
58+ let num_threads = git_features:: parallel:: num_threads ( thread_limit) ;
5859 let path_backing_buffer_size = entries:: estimate_path_storage_requirements_in_bytes (
5960 num_entries,
6061 data. len ( ) ,
6162 start_of_extensions,
6263 object_hash,
6364 version,
6465 ) ;
66+
6567 let ( entries, ext, data) = match start_of_extensions {
66- Some ( offset) => {
68+ Some ( offset) if num_threads > 1 => {
6769 let start_of_extensions = & data[ offset..] ;
6870 let index_offsets_table = extension:: index_entry_offset_table:: find ( start_of_extensions, object_hash) ;
6971 let ( entries_res, ( ext, data) ) = match index_offsets_table {
@@ -89,7 +91,7 @@ impl State {
8991 } ;
9092 ( entries_res?. 0 , ext, data)
9193 }
92- None => {
94+ None | Some ( _ ) => {
9395 let ( entries, data) = entries:: load_all (
9496 post_header_data,
9597 num_entries,
0 commit comments