Re: [PATCH 1/7] diffcore-rename: use a mem_pool for exact rename detection's hashmap
- From
Elijah Newren <newren@gmail.com>
- Date
- Jul 23, 2021, 22:03 UTC
- Message-ID
- <CABPp-BHmY37fNw36E6d8thExA13zWY3sROewoHqT3CBA-Bj2Gg@mail.gmail.com>
- In-Reply-To
- <CAPig+cQK8F2p4JT6FCFxNALxhoj2_opZit-ao=pLNhOHxN+gDw@mail.gmail.com>
On Fri, Jul 23, 2021 at 2:59 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 18 quoted lines
> > On Fri, Jul 23, 2021 at 8:55 AM Elijah Newren via GitGitGadget > <gitgitgadget@gmail.com> wrote: > > Exact rename detection, via insert_file_table(), uses a hashmap to store > > files by oid. Use a mem_pool for the hashmap entries so these can all be > > allocated and deallocated together. > > [...] > > Signed-off-by: Elijah Newren <newren@gmail.com> > > --- > > diff --git a/diffcore-rename.c b/diffcore-rename.c > > @@ -355,7 +357,7 @@ static int find_exact_renames(struct diff_options *options) > > /* Free the hash data structure and entries */ > > - hashmap_clear_and_free(&file_table, struct file_similarity, entry); > > + hashmap_clear(&file_table); > > Does the in-code comment become a bit out of date with this change? > (It might make sense to drop the comment altogether -- or, if not, > explain that the hashmap entries get thrown away later with the pool?)
Ah, good catch. Yeah, I should update it or drop the comment.
> Not necessarily worth a re-roll.
I'm sure someone will comment on something else, so I'll just include this among the fixes.