Re: [PATCH] wt-status: avoid quadratic insertion for untracked paths
- From
Sahitya Chandra <sahityajb@gmail.com>
- Date
- Jul 17, 2026, 14:37 UTC
- Message-ID
- <CAP=WS+tb-HnMmOjH7i+ZY0EBOT0xfDPi4wsTboiH0mRtCCs=ng@mail.gmail.com>
- In-Reply-To
- <alnLPSnOt_Sf7cA5@pks.im>
On Fri, Jul 17, 2026 at 11:57 AM Patrick Steinhardt <ps@pks.im> wrote:
> Out of curiosity: is this something that you have encountered in the > real world as inefficient, or is this rather a theoretical inefficiency? > If the former it would be great to add a small benchmark to the commit > message.
Thanks for asking. I do not have a real-world benchmark for this. After Jeff's reply, I agree that the O(n^2) claim is too strong for the current code path because fill_directory() already returns the entries sorted, so string_list_insert() should usually append at the end.
I have reworded v2 to avoid that performance claim and describe the change as making the collection strategy explicit instead.
> Instead of sorting and then deduplicating you can call > `string_list_sort_u()`. It does the exact same thing as you do here, but > I guess it makes sense to use that interface anyway.
Done in v2. Thanks.