Re: [PATCH v3 1/4] alloc: introduce parsed_commits_count
- From
Abhishek Kumar <abhishekkumar8222@gmail.com>
- Date
- Jun 13, 2020, 18:57 UTC
- Message-ID
- <20200613185713.GA73354@Abhishek-Arch>
- In-Reply-To
- <xmqq8sgr28yd.fsf@gitster.c.googlers.com>
On Fri, Jun 12, 2020 at 03:52:26PM -0700, Junio C Hamano wrote:
Show 43 quoted lines
> Abhishek Kumar <abhishekkumar8222@gmail.com> writes:
>
> > static unsigned int alloc_commit_index(struct repository *r)
> > {
> > - return r->parsed_objects->commit_count++;
> > + static unsigned int parsed_commits_count = 0;
> > + r->parsed_objects->commit_count++;
> > + return parsed_commits_count++;
> > }
>
> I'll queue this as-is, together with the rest of the series, but
> with the following SQUASH??? to document why we are counting
> globally.
>
> I do not think r->parsed_objects->*_count is used by anybody, and we
> probably can eventually get rid of these stats fields, and when that
> happens, we may want to lose the "struct repository *" pointer from
> the functions in the callchain, but not right now.
>
> Thanks.
>
> alloc.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/alloc.c b/alloc.c
> index 29f0e3aa80..ee92661b71 100644
> --- a/alloc.c
> +++ b/alloc.c
> @@ -99,6 +99,11 @@ void *alloc_object_node(struct repository *r)
> return obj;
> }
>
> +/*
> + * The returned count is to be used as an index into commit slabs,
> + * that are *NOT* maintained per repository, and that is why a single
> + * global counter is used.
> + */
> static unsigned int alloc_commit_index(struct repository *r)
> {
> static unsigned int parsed_commits_count = 0;
> --
> 2.27.0-90-geebb51ba8c
> Thanks for taking a closer look. I have created an issue on gitgitgadget [1] to get rid of commit count and avoid passing repository to the functions anymore.
[1]: https://github.com/gitgitgadget/git/issues/657
Abhishek