git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] wt-status: avoid quadratic insertion for untracked paths

From
Sahitya Chandra <sahityajb@gmail.com>
Date
Jul 17, 2026, 14:40 UTC
Message-ID
<CAP=WS+uWJJ3MY9K3JX-PQo_pKimNtyCO_fTdFsA=AXqbzO-bLg@mail.gmail.com>
In-Reply-To
<20260717075449.GA1832790@coredump.intra.peff.net>
On Fri, Jul 17, 2026 at 1:24 PM Jeff King <peff@peff.net> wrote:
Show 7 quoted lines
> Yeah, I had the same question, and tried for a moment to produce an
> example before realizing that it probably is theoretical. If we are
> feeding the entries in pre-sorted order then the insert is always O(1).
>
> I think it's still worth doing this, though, as it makes the result much
> more obvious to analyze. I think it could even be O(n) if the sort
> implementation is optimized under the hood for pre-sorted inputs.

Thanks, that makes sense. I updated v2 to avoid claiming this is a current O(n^2) problem and instead frame it as making the append, sort, and deduplicate steps explicit.

I also switched to string_list_sort_u() as Patrick suggested.
Previous: Jeff KingNext: Sahitya Chandra
Message 4 of 10 in “wt-status: avoid quadratic insertion for untracked paths”
  1. wt-status: avoid quadratic insertion for untracked pathsSahitya Chandra, Jul 16, 2026
  2. Patrick SteinhardtJul 17, 2026
  3. Jeff KingJul 17, 2026
  4. Sahitya ChandraJul 17, 2026
  5. Sahitya ChandraJul 17, 2026
  6. wt-status: avoid repeated insertion for untracked pathsSahitya Chandra, Jul 17, 2026
  7. Jeff KingJul 18, 2026
  8. Sahitya ChandraJul 18, 2026
  9. wt-status: avoid repeated insertion for untracked pathsSahitya Chandra, Jul 18, 2026
  10. Jeff KingJul 18, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.