Re: [PATCH v2] commit-reach: simplify cleanup of remaining bitmaps in ahead_behind()
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Mar 20, 2026, 16:35 UTC
- Message-ID
- <ac4df3ef-1704-4a1b-a47c-6fe96ae1c01f@gmail.com>
- In-Reply-To
- <xmqqjyv7lnmz.fsf@gitster.g>
On 3/19/2026 1:44 PM, Junio C Hamano wrote:
Show 5 quoted lines
> René Scharfe <l.s.r@web.de> writes: > >> Don't bother extracting the last few remaining prio_queue items in >> order when we only want to free their associated bitmaps; just iterate >> over the item array.
> Quite obvious and straightforward. Will queue. Thanks.
Show 6 quoted lines
>> - while (prio_queue_peek(&queue)) {
>> - struct commit *c = prio_queue_get(&queue);
>> - free_bit_array(c);
>> - }
>> + for (size_t i = 0; i < queue.nr; i++)
>> + free_bit_array(queue.array[i].data);I like this cleanup quite a bit, thanks! I appreciate your self-review on the performance side, too. Thinking out loud like that can help other (e.g. me) avoid similar mistakes in the future.
Thanks, -Stolee