diff mbox series

[1/6] index-pack: unify threaded and unthreaded code

Message ID 32ef0122a55bfbdbde0595b2aad930d83b27dd6d.1570663470.git.jonathantanmy@google.com (mailing list archive)
State New, archived
Headers show
Series Better threaded delta resolution in index-pack | expand

Commit Message

Jonathan Tan Oct. 9, 2019, 11:44 p.m. UTC
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 builtin/index-pack.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Jeff King Oct. 17, 2019, 6:20 a.m. UTC | #1
On Wed, Oct 09, 2019 at 04:44:17PM -0700, Jonathan Tan wrote:

> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
>  builtin/index-pack.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/builtin/index-pack.c b/builtin/index-pack.c
> index a23454da6e..1a2600d4b3 100644
> --- a/builtin/index-pack.c
> +++ b/builtin/index-pack.c
> @@ -1210,15 +1210,7 @@ static void resolve_deltas(void)
>  		cleanup_thread();
>  		return;
>  	}
> -
> -	for (i = 0; i < nr_objects; i++) {
> -		struct object_entry *obj = &objects[i];
> -
> -		if (is_delta_type(obj->type))
> -			continue;
> -		resolve_base(obj);
> -		display_progress(progress, nr_resolved_deltas);
> -	}
> +	threaded_second_pass(&nothread_data);
>  }

I wondered at first if this would be a problem with NO_PTHREADS. But I
think since the cleanups around 2094c5e582 (index-pack: remove #ifdef
NO_PTHREADS, 2018-11-03), we always define threaded_second_pass(), even
if all the locks are noops and we only ever have one thread.

-Peff
diff mbox series

Patch

diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index a23454da6e..1a2600d4b3 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1210,15 +1210,7 @@  static void resolve_deltas(void)
 		cleanup_thread();
 		return;
 	}
-
-	for (i = 0; i < nr_objects; i++) {
-		struct object_entry *obj = &objects[i];
-
-		if (is_delta_type(obj->type))
-			continue;
-		resolve_base(obj);
-		display_progress(progress, nr_resolved_deltas);
-	}
+	threaded_second_pass(&nothread_data);
 }
 
 /*