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

Re: [PATCH] remote.c: avoid O(n^2) behavior in match_push_refs by using string_list

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 3, 2013, 20:22 UTC
Message-ID
<7v7gh7e6mh.fsf@alter.siamese.dyndns.org>
In-Reply-To
<51D479BA.1070207@nvidia.com>
Brandon Casey <bcasey@nvidia.com> writes:
Show 14 quoted lines
>> ... by penalizing the common case by how much?  If it is not too
>> much, then this obviously would be a good change.
>
> For something the size of the git repo, 5 branches, and pushing with
> matching refspecs, I can't measure any difference.  The fastest time I
> record with or without this patch is the same:
>
>    $ time git push -n
>    real    0m0.178s
>    user    0m0.020s
>    sys     0m0.008s
>
> Ditto, when only pushing a single branch.  Preparing the string list for
> a repo with a "normal" number of refs has very little overhead.

My repository git.git and Linus's kernel are not "normal". It did not matter so far to have O(n*m) when pushing to our histories.

The case that matters is for somebody to be pushing one (or a few) refs against a repository with many many refs, like pushing a review request to Gerrit instance, which I think Martin has in mind.

Previous: Brandon CaseyNext: Brandon Casey
Message 8 of 12 in “remote.c: avoid O(n^2) behavior in match_push_refs by using string_list”
  1. remote.c: avoid O(n^2) behavior in match_push_refs by using string_listBrandon Casey, Jul 2, 2013
  2. Jeff KingJul 3, 2013
  3. Brandon CaseyJul 3, 2013
  4. Junio C HamanoJul 3, 2013
  5. Jeff KingJul 3, 2013
  6. Brandon CaseyJul 3, 2013
  7. Brandon CaseyJul 3, 2013
  8. Junio C HamanoJul 3, 2013
  9. remote.c: avoid O(m*n) behavior in match_push_refsBrandon Casey, Jul 8, 2013
  10. Jeff KingJul 8, 2013
  11. remote.c: avoid O(m*n) behavior in match_push_refsBrandon Casey, Jul 8, 2013
  12. Junio C HamanoJul 8, 2013

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.