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

Re: [PATCHv3 3/4] gitweb: separate heads and remotes lists

From
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date
Nov 17, 2008, 13:31 UTC
Message-ID
<cb7bb73a0811170531o45f0970cyf225ecab087ccb5@mail.gmail.com>
In-Reply-To
<cb7bb73a0811170511s4df6efbbl220fa89469388aca@mail.gmail.com>

On Mon, Nov 17, 2008 at 2:11 PM, Giuseppe Bilotta <giuseppe.bilotta@gmail.com> wrote:

Show 33 quoted lines
> On Sun, Nov 16, 2008 at 6:34 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Giuseppe Bilotta <giuseppe.bilotta@gmail.com> writes:
>>> -     my @headlist = git_get_heads_list(16);
>>> +     my @headlist = git_get_heads_list(16, 'heads');
>>> +     my @remotelist = $remote_heads ? git_get_heads_list(16, 'remotes') : ();
>>
>> Wasteful to run one for-each-ref for each list.
>>
>> You earlier introduced $ref_item{'class'} so that you can differenciate
>> what you got from git_get_heads_list(); make use of it, perhaps like:
>>
>>        my @heads_list = git_get_heads_list(16, \%head_class);
>>        my @headlist = grep { $_->{'class'} eq 'head' } @heads_list;
>>        my @remotelist = grep { $_->{'class'} eq 'remote' } @heads_list;
>>
>> By the way, your [2/4] used "heads" and "remotes" as class, while your
>> [1/4] stored 'head' and 'remote' in $ref_item{'class'}.  Notice the above
>> suggestion corrects this discrepancy as well.
>
> Although I agree with the head_class idea, I would like to point out
> that doing a single git call to retrieve all refs and then selecting
> the ones we want and doing multiple git calls are not equivalent.
>
> First of all, with multiple calls we can limit the calls to retrieve
> at most 16 refs of each kind, whereas this cannot be done with a
> single call for all the refs. I'm not sure however, performance-wise,
> if it's faster to filter the first 16 refs of each after retrieving
> all of them, or doing multiple calls, especially with lots of refs.
>
> Moreover, gitweb is already doing multiple for-each-ref calls to get
> tags and heads. I guess that at this point we could go the extra mile
> and include tags in the refs management. Of course, the problem of how
> to handle the rate limiting remains.

Sorry, replying to myself here. After more careful reading and some more accurate testing, I gather that tags and heads management is different enough to justify totally separate methods, and the cost of an additional git call. It *could* still be merged (possibly with a slightly different format string to accomodate both cases), but we would have to do sorting ourselves, and such stuff. Not sure it's worth it (yet).

My perplexity about rate limiting and separate calls for separate head classes still remains, though.

-- 
Giuseppe "Oblomov" Bilotta
Previous: Giuseppe BilottaNext: Junio C Hamano
Message 8 of 14 in “[PATCHv3 0/4] gitweb: remote heads feature”
  1. Giuseppe BilottaNov 16, 2008
  2. 1/4 gitweb: introduce remote_heads featureGiuseppe Bilotta, Nov 16, 2008
  3. 2/4 gitweb: git_get_heads_list accepts an optional list of refs.Giuseppe Bilotta, Nov 16, 2008
  4. 3/4 gitweb: separate heads and remotes listsGiuseppe Bilotta, Nov 16, 2008
  5. 4/4 gitweb: link heads and remotes viewGiuseppe Bilotta, Nov 16, 2008
  6. Junio C HamanoNov 16, 2008
  7. Giuseppe BilottaNov 17, 2008
  8. Giuseppe BilottaNov 17, 2008
  9. Junio C HamanoNov 16, 2008
  10. Jakub NarebskiNov 17, 2008
  11. Junio C HamanoNov 16, 2008
  12. Giuseppe BilottaNov 16, 2008
  13. Junio C HamanoNov 16, 2008
  14. Giuseppe BilottaNov 16, 2008

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.