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

Re: [PATCH 1/2] midx: show progress during QSORT operation

From
Ayush Chandekar <ayu.chandekar@gmail.com>
Date
Feb 11, 2025, 12:23 UTC
Message-ID
<CAE7as+YPKuBd+ztBerim6e1kZXZwUHdb_qjcMfZSBa4LkiyJow@mail.gmail.com>
In-Reply-To
<xmqqzfitbuy1.fsf@gitster.g>
> Hmph.  If the implementation is correct (which I cannot tell), this
> needs to explain why it is a bit better than saying nothing.

While going through the code, I noticed the TODO comment: "Measure QSORT() progress", and I thought it might be interesting to explore. For big codebases, being stuck at zero would make it feel like there's no progress happening and that is why putting a progress might be better.

Show 8 quoted lines
> >  static int compare_pair_pos_vs_id(const void *_a, const void *_b)
> >  {
> >       struct pair_pos_vs_id *a = (struct pair_pos_vs_id *)_a;
> >       struct pair_pos_vs_id *b = (struct pair_pos_vs_id *)_b;
>
> This is a compar callback function used by the sorting machinery,
> which is called QSORT but system-provided qsort() implementations
> are not necessarily quick-sort [*].
Oh.

Initially, I was unsure how to approach it, but I believed that tracking the highest pos value seen in comparisons could give a rough estimate of progress. However, as you pointed out, this assumes that qsort() processes elements in a structured way where the highest-indexed element isn't compared until later in the sort. I now see that this isn't a safe assumption Since there's no guarantee that progress would be reflected meaningfully, this approach isn't good.

Let me know if you have any suggestions/comments:)

Thanks, Ayush

Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 6 in “midx: implement progress reporting for QSORT operation”
  1. Ayush ChandekarFeb 10, 2025
  2. 2/2 t5319: add test for MIDX QSORT progress reportingAyush Chandekar, Feb 10, 2025
  3. 1/2 midx: show progress during QSORT operationAyush Chandekar, Feb 10, 2025
  4. Junio C HamanoFeb 10, 2025
  5. Ayush ChandekarFeb 11, 2025
  6. Junio C HamanoFeb 11, 2025

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.