Re: [PATCH 03/12] shallow.c: use commit-slab for commit depth instead of commit->util

2018-05-12 Thread Jeff King
On Sat, May 12, 2018 at 02:09:18PM +0200, Duy Nguyen wrote: > > That wastes an extra 4 bytes per slot over storing an int directly, but > > it's the same as storing an 8-byte pointer, plus you avoid the storage > > and runtime overhead of malloc. > > Or we could have a way to let the user decide

Re: [PATCH 03/12] shallow.c: use commit-slab for commit depth instead of commit->util

2018-05-12 Thread Duy Nguyen
On Sat, May 12, 2018 at 11:18 AM, Jeff King wrote: > On Sat, May 12, 2018 at 05:07:48AM -0400, Jeff King wrote: > >> So no, it wouldn't work to directly store depths with the code as >> written. I'm not sure if the depth can ever be 0. If not, then it would >> be a suitable sentinel as: >> >> i

Re: [PATCH 03/12] shallow.c: use commit-slab for commit depth instead of commit->util

2018-05-12 Thread Duy Nguyen
On Sat, May 12, 2018 at 11:07 AM, Jeff King wrote: > On Sat, May 12, 2018 at 10:00:19AM +0200, Nguyễn Thái Ngọc Duy wrote: > >> @@ -82,25 +84,29 @@ struct commit_list *get_shallow_commits(struct >> object_array *heads, int depth, >> struct object_array stack = OBJECT_ARRAY_INIT; >> st

Re: [PATCH 03/12] shallow.c: use commit-slab for commit depth instead of commit->util

2018-05-12 Thread Jeff King
On Sat, May 12, 2018 at 05:07:48AM -0400, Jeff King wrote: > So no, it wouldn't work to directly store depths with the code as > written. I'm not sure if the depth can ever be 0. If not, then it would > be a suitable sentinel as: > > int *slot = commit_depth_at(&depths, p->item); > if (!*slo

Re: [PATCH 03/12] shallow.c: use commit-slab for commit depth instead of commit->util

2018-05-12 Thread Jeff King
On Sat, May 12, 2018 at 10:00:19AM +0200, Nguyễn Thái Ngọc Duy wrote: > @@ -82,25 +84,29 @@ struct commit_list *get_shallow_commits(struct > object_array *heads, int depth, > struct object_array stack = OBJECT_ARRAY_INIT; > struct commit *commit = NULL; > struct commit_graft *gr

[PATCH 03/12] shallow.c: use commit-slab for commit depth instead of commit->util

2018-05-12 Thread Nguyễn Thái Ngọc Duy
It's done so that commit->util can be removed. See more explanation in the commit that removes commit->util. While at there, plug a leak for keeping track of depth in this code. Signed-off-by: Nguyễn Thái Ngọc Duy --- shallow.c | 37 + 1 file changed, 25 inse