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

Re: [PATCH] sparse-checkout: optimize string_list construction

From
Jeff King <peff@peff.net>
Date
Jan 19, 2026, 05:32 UTC
Message-ID
<20260119053251.GA1991605@coredump.intra.peff.net>
In-Reply-To
<xmqqqzrp74q3.fsf@gitster.g>
On Fri, Jan 16, 2026 at 11:11:16AM -0800, Junio C Hamano wrote:
Show 7 quoted lines
> > Improve O(n^2) complexity to O(n log n) while building a sorted
> > 'string_list' by constructing it unsorted then sorting it
> > followed by removing duplicates.
> 
> By the way, do we have t/perf/ that substanticates the performance
> claim here (in other words, how much improvement are we expecting in
> practice)?

IMHO it is not that big a deal to demonstrate the perf improvement in the test suite.

Probably you could feed a very long list of unique names to "git sparse-checkout add --stdin" to trigger it. But a list long enough to cause annoying quadratic behavior is getting far enough from the real world that I'm not sure it is worth adding to the (already expensive) perf suite.

And swapping append+sort for sorted insertion is a common and simple improvement. We probably don't need to prove its performance at all, but if we do, a one-off hyperfine output in the commit message would be enough.

-Peff
Previous: Amisha ChhajedNext: Junio C Hamano
Message 18 of 28 in “sparse-checkout: optimize string_list construction”
  1. sparse-checkout: optimize string_list constructionamisha, Jan 14, 2026
  2. Jeff KingJan 14, 2026
  3. Derrick StoleeJan 18, 2026
  4. sparse-checkout: optimize string_list constructionamisha, Jan 15, 2026
  5. sparse-checkout: optimize string_list constructionamisha, Jan 15, 2026
  6. Amisha ChhajedJan 15, 2026
  7. Jeff KingJan 15, 2026
  8. Amisha ChhajedJan 16, 2026
  9. René ScharfeJan 15, 2026
  10. Amisha ChhajedJan 16, 2026
  11. Junio C HamanoJan 16, 2026
  12. Derrick StoleeJan 18, 2026
  13. Amisha ChhajedJan 18, 2026
  14. Junio C HamanoJan 15, 2026
  15. sparse-checkout: optimize string_list constructionamisha, Jan 16, 2026
  16. Junio C HamanoJan 16, 2026
  17. Amisha ChhajedJan 18, 2026
  18. Jeff KingJan 19, 2026
  19. Junio C HamanoJan 19, 2026
  20. 1/2 sparse-checkout: optimize string_list constructionamisha, Jan 19, 2026
  21. Derrick StoleeJan 19, 2026
  22. Pushkar SinghJan 19, 2026
  23. Amisha ChhajedJan 20, 2026
  24. sparse-checkout: optimize string_list construction and add tests to verify deduplication.amisha, Jan 20, 2026
  25. Derrick StoleeJan 20, 2026
  26. sparse-checkout: optimize string_list construction and add tests to verify deduplication.Amisha Chhajed, Jan 21, 2026
  27. Derrick StoleeJan 21, 2026
  28. Junio C HamanoJan 21, 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.