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

Re: fix git-pack-redundant crashing sometimes

From
Fredrik Kuivinen <freku045@student.liu.se>
Date
Nov 17, 2005, 07:08 UTC
Message-ID
<20051117070852.GA4921@c165.ib.student.liu.se>
In-Reply-To
<437BA6A6.8080900@etek.chalmers.se>
On Wed, Nov 16, 2005 at 10:37:42PM +0100, Lukas Sandström wrote:
Show 27 quoted lines
> Linus Torvalds wrote:
> > 
> > On Tue, 15 Nov 2005, Alex Riesen wrote:
> > 
> >>Sorry, it doesn't. The code loops here:
> >>
> >>401             /* find the permutations which contain all missing objects */
> >>402             perm_all = perm = get_all_permutations(non_unique);
> > 
> > 
> > Looks like the whole thing is exponential.
> > 
> Slightly less, but not far from.
> > A good way to do sane pack handling is to keep a _sorted_ list of all 
> > objects each pack has. At that point it becomes much easier to see which 
> > objects only exist in one particular pack.
> > 
> git-pack-redundant already does this.
> > The sorting itself is O(nlogn), and the "does this pack have any unique 
> > objects" (or "is this pack a superset of all other packs") question should 
> > then be O(n).
> > 
> Ah, but the question is: "Does this set of packs contain a superset of
> all objects available in packfiles?" The answer to the question for a
> certain set is indeed O(n), but the number of sets which have to be tested
> are ~ O(e**n). (Where n is the number of non-unique packs.)
> 

If haven't looked closely at neither the packing nor the pack redundant code, but the problem looks very similar to Minimum Set Cover (see http://www.nada.kth.se/~viggo/wwwcompendium/node146.html for more information), which is NP-hard. So, if Minimum Set Cover is the problem we are trying to solve we can't hope to find a polynomial time algorithm. However, there is a quite simple greedy approximation algorithm in [1] which is referenced from the URL above.

- Fredrik
[1]: Johnson, D. S. (1974), "Approximation algorithms for
     combinatorial problems", J. Comput. System Sci. 9, 256-278.
Previous: Matthias UrlichsNext: Lukas Sandström
Message 18 of 21 in “fix git-pack-redundant crashing sometimes”
  1. Alex RiesenNov 15, 2005
  2. Timo HirvonenNov 15, 2005
  3. Alex RiesenNov 15, 2005
  4. Linus TorvaldsNov 15, 2005
  5. Lukas SandströmNov 15, 2005
  6. Fix llist_sorted_difference_inplace in git-pack-redundantLukas Sandström, Nov 15, 2005
  7. Alex RiesenNov 15, 2005
  8. Lukas SandströmNov 15, 2005
  9. Alex RiesenNov 15, 2005
  10. Lukas SandströmNov 15, 2005
  11. Alex RiesenNov 16, 2005
  12. Alex RiesenNov 16, 2005
  13. Linus TorvaldsNov 15, 2005
  14. Junio C HamanoNov 16, 2005
  15. Lukas SandströmNov 16, 2005
  16. Lukas SandströmNov 16, 2005
  17. Matthias UrlichsNov 17, 2005
  18. Fredrik KuivinenNov 17, 2005
  19. Make git-pack-redundant non-horribly slow on large sets of packsLukas Sandström, Nov 17, 2005
  20. Fix bug introduced by the latest changes to git-pack-redundantLukas Sandström, Nov 18, 2005
  21. Fix a bug in get_all_permutations.Lukas Sandström, Nov 18, 2005

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.