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

Re: [PATCH 4/4] gc --aggressive: three phase repacking

From
David Kastrup <dak@gnu.org>
Date
Mar 18, 2014, 06:19 UTC
Message-ID
<87lhw8vxj4.fsf@fencepost.gnu.org>
In-Reply-To
<20140318050727.GA14769@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 47 quoted lines
> On Tue, Mar 18, 2014 at 12:50:50AM -0400, Jeff King wrote:
>
>> On Sun, Mar 16, 2014 at 08:35:04PM +0700, Nguyễn Thái Ngọc Duy wrote:
>> 
>> > As explained in the previous commit, current aggressive settings
>> > --depth=250 --window=250 could slow down repository access
>> > significantly. Notice that people usually work on recent history only,
>> > we could keep recent history more loosely packed, so that repo access
>> > is fast most of the time while the pack file remains small.
>> 
>> One thing I have not seen is real-world timings showing the slowdown
>> based on --depth. Did I miss them, or are we just making assumptions
>> based on one old case from 2009 (that, AFAIK does not have real numbers,
>> just speculation)? Has anyone measured the effect of bumping the delta
>> cache size (and its hash implementation)?
>
> Just as a very quick, rough data point, here are before-and-after
> timings for the patch below doing "git rev-list --objects --all" on my
> linux.git, which is a mix of "--aggressive" and normal packing (I didn't
> do a "repack -f", but it's partially what I've downloaded from k.org and
> what I've repacked in various experiments over the past few months).
>
>   [before]
>   real    0m28.824s
>   user    0m28.620s
>   sys     0m0.232s
>
>   [after]
>   real    0m21.694s
>   user    0m21.544s
>   sys     0m0.172s
>
> The numbers below are completely pulled out of a hat, so we can perhaps
> do even better. But I think it shows that there is room for improvement
> in the delta base cache.
>
> ---
> diff --git a/environment.c b/environment.c
> index c3c8606..73ed670 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -37,7 +37,7 @@ int core_compression_seen;
>  int fsync_object_files;
>  size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
>  size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
> -size_t delta_base_cache_limit = 16 * 1024 * 1024;
> +size_t delta_base_cache_limit = 128 * 1024 * 1024;
You need to change a file in Documentation as well.  Can offer a patch.
Show 13 quoted lines
>  unsigned long big_file_threshold = 512 * 1024 * 1024;
>  const char *pager_program;
>  int pager_use_color = 1;
> diff --git a/sha1_file.c b/sha1_file.c
> index b37c6f6..a9ab8e3 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -1944,7 +1944,7 @@ static void *unpack_compressed_entry(struct packed_git *p,
>  	return buffer;
>  }
>  
> -#define MAX_DELTA_CACHE (256)
> +#define MAX_DELTA_CACHE (1024)

This one really needs experimentation. I found that increases here lead to performance degradation rather soon, probably because of decreased memory locality without significant reduction in cache collisions. Not sure whether it's worth touching at all.

-- 
David Kastrup
Previous: David KastrupNext: Duy Nguyen
Message 19 of 21 in “Better "gc --aggressive"”
  1. 0/4 Better "gc --aggressive"Nguyễn Thái Ngọc Duy, Mar 16, 2014
  2. 1/4 environment.c: fix constness for odb_pack_keep()Nguyễn Thái Ngọc Duy, Mar 16, 2014
  3. index-pack: do not segfault when keep_name is NULLNguyễn Thái Ngọc Duy, Mar 16, 2014
  4. 2/4 pack-objects: support --keepNguyễn Thái Ngọc Duy, Mar 16, 2014
  5. 3/4 gc --aggressive: make --depth configurableNguyễn Thái Ngọc Duy, Mar 16, 2014
  6. 4/4 gc --aggressive: three phase repackingNguyễn Thái Ngọc Duy, Mar 16, 2014
  7. Junio C HamanoMar 17, 2014
  8. Duy NguyenMar 17, 2014
  9. Junio C HamanoMar 17, 2014
  10. Jeff KingMar 18, 2014
  11. Duy NguyenMar 18, 2014
  12. Jeff KingMar 18, 2014
  13. David KastrupMar 18, 2014
  14. Duy NguyenMar 19, 2014
  15. Jeff KingMar 18, 2014
  16. Duy NguyenMar 18, 2014
  17. Duy NguyenMar 18, 2014
  18. David KastrupMar 18, 2014
  19. David KastrupMar 18, 2014
  20. Duy NguyenMar 16, 2014
  21. Duy NguyenMar 20, 2014

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.