Better "gc --aggressive"
cover Better "gc --aggressive"
See [1] for the discussion that led to this series. It attempts to pack the repo with two different depths: old history tightly packed (smaller but also takes longer time to access) and recent history on the opposite.
First draft, probably still some bugs lurking in pack_old_history(). It would be great if people could try it out on large repos and report back the results (pack size between the old and new aggressive, gc time, git log and blame speed...)
[1] http://thread.gmane.org/gmane.comp.version-control.git/242277
Nguyễn Thái Ngọc Duy (4):
environment.c: fix constness for odb_pack_keep()
pack-objects: support --keep
gc --aggressive: make --depth configurable gc --aggressive: three phase repacking
Documentation/config.txt | 24 ++++++++ Documentation/git-gc.txt | 3 + Documentation/git-pack-objects.txt | 4 ++ builtin/gc.c | 113 ++++++++++++++++++++++++++++++++++++- builtin/pack-objects.c | 26 +++++++++ environment.c | 2 +- git-compat-util.h | 2 +- 7 files changed, 169 insertions(+), 5 deletions(-)
Signature · 1 line
1.9.0.40.gaa8c3ea
PATCH 1/4 environment.c: fix constness for odb_pack_keep()
--- environment.c | 2 +- git-compat-util.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
environment.c +1 -1
@@ -237,7 +237,7 @@ int odb_mkstemp(char *template, size_t limit, const char *pattern)return xmkstemp_mode (template, mode); } -int odb_pack_keep (char *name,size_t namesz,unsigned char *sha1) +int odb_pack_keep (char *name,size_t namesz,const unsigned char *sha1) {int fd;
git-compat-util.h +1 -1
@@ -533,7 +533,7 @@ extern FILE *xfdopen(int fd, const char *mode);extern int xmkstemp (char *template);extern int xmkstemp_mode (char *template,int mode);extern int odb_mkstemp (char *template,size_t limit,const char *pattern); -extern int odb_pack_keep (char *name,size_t namesz,unsigned char *sha1); +extern int odb_pack_keep (char *name,size_t namesz,const unsigned char *sha1);static inline size_t xsize_t (off_t len) {
Signature · 1 line
1.9.0.40.gaa8c3ea
PATCH 1/1 index-pack: do not segfault when keep_name is NULL
In reply to Nguyễn Thái Ngọc Duykeep_name is used to print error messages a couple lines down. Reset it to the real path returned by odb_pack_keep() if it's set to NULL by caller.
---
One of these moments I will make git log and friends optionally recognize "Diff-Options:" line in commit message. Adding -U14 in this case should help the reviewer to see how those error messages are printed.
builtin/index-pack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
builtin/index-pack.c +3 -2
@@ -1283,9 +1283,10 @@ static void final(const char *final_pack_name, const char *curr_pack_name,if (keep_msg) {int keep_fd, keep_msg_len =strlen (keep_msg); -if (!keep_name) +if (!keep_name) { keep_fd =odb_pack_keep (name,sizeof (name), sha1); -else + keep_name = name; + }else keep_fd =open (keep_name,O_RDWR |O_CREAT |O_EXCL ,0600 );if (keep_fd <0 ) {
Signature · 1 line
1.9.0.40.gaa8c3ea
PATCH 2/4 pack-objects: support --keep
In reply to Nguyễn Thái Ngọc Duy--- Documentation/git-pack-objects.txt | 4 ++++ builtin/pack-objects.c | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+)
Documentation/git-pack-objects.txt +4 -0
@@ -117,6 +117,10 @@ base-name:: has a .keep file to be ignored, even if it would have otherwise been packed. +--keep:: + Before moving the index into its final destination + create an empty .keep file for the associated pack file. + --incremental:: This flag causes an object already in a pack to be ignored even if it would have otherwise been packed.
builtin/pack-objects.c +26 -0
@@ -57,6 +57,7 @@ static int num_preferred_base;static struct progress *progress_state;static int pack_compression_level =Z_DEFAULT_COMPRESSION ;static int pack_compression_seen; +static int keep_pack;static struct packed_git *reuse_packfile;static uint32_t reuse_packfile_objects;
@@ -745,6 +746,23 @@ static off_t write_reused_pack(struct sha1file *f)return reuse_packfile_offset -sizeof (struct pack_header ); } +static void write_keep_file (const unsigned char *sha1) +{ +const char *msg ="pack-objects --keep\n" ; +char name[PATH_MAX ]; +int keep_fd =odb_pack_keep (name,sizeof (name), sha1); +if (keep_fd <0 ) { +if (errno !=EEXIST ) +die_errno (_ ("cannot write keep file '%s'" ), + name); +return ; + } +write_or_die (keep_fd, msg,strlen (msg)); +if (close (keep_fd) !=0 ) +die_errno (_ ("cannot close written keep file '%s'" ), + name); +} +static void write_pack_file (void ) {uint32_t i =0 , j;
@@ -805,6 +823,9 @@ static void write_pack_file(void)struct stat st;char tmpname[PATH_MAX ]; +if (keep_pack) +write_keep_file (sha1); +/* * Packs are runtime accessed in their mtime * order since newer packs are more likely to contain
@@ -2609,6 +2630,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) N_("use a bitmap index if available to speed up counting objects")),OPT_BOOL (0 ,"write-bitmap-index" , &write_bitmap_index,N_ ("write a bitmap index together with the pack index" )), +OPT_BOOL (0 ,"keep" , &keep_pack, +N_ ("create .keep for the new pack" )), OPT_END(), };
@@ -2672,6 +2695,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)if (!pack_to_stdout && thin)die ("--thin cannot be used to build an indexable pack." ); +if (pack_to_stdout && keep_pack) +die ("--keep cannot be used with --stdout" ); +if (keep_unreachable && unpack_unreachable)die ("--keep-unreachable and --unpack-unreachable are incompatible." );
Signature · 1 line
1.9.0.40.gaa8c3ea
PATCH 3/4 gc --aggressive: make --depth configurable
In reply to Nguyễn Thái Ngọc DuyWhen 1c192f3 (gc --aggressive: make it really aggressive - 2007-12-06) made --depth=250 the default value, it didn't really explain the reason behind, especially the pros and cons of --depth=250.
An old mail from Linus below explains it at length. Long story short, --depth=250 is a disk saver and a performance killer. Not everybody agrees on that aggressiveness. Let the user configure it.
-- 8< --
From: Linus Torvalds <[email protected]>
Subject: Re: [PATCH] gc --aggressive: make it really aggressive
Date: Thu, 6 Dec 2007 08:19:24 -0800 (PST)
Message-ID: <[email protected]>
Gmane-URL: http://article.gmane.org/gmane.comp.gcc.devel/94637
Quoted 2 lines · Harvey Harrison
7:41:25elapsed 86%CPU
Heh. And this is why you want to do it exactly *once*, and then just export the end result for others ;)
Quoted 1 line
-r--r--r-- 1 hharrison hharrison 324094684 2007-12-06 07:26 pack-1d46ca030c3d6d6b95ad316deb922be06b167a3d.pack
But yeah, especially if you allow longer delta chains, the end result can be much smaller (and what makes the one-time repack more expensive is the window size, not the delta chain - you could make the delta chains longer with no cost overhead at packing time)
HOWEVER.
The longer delta chains do make it potentially much more expensive to then use old history. So there's a trade-off. And quite frankly, a delta depth of 250 is likely going to cause overflows in the delta cache (which is only 256 entries in size *and* it's a hash, so it's going to start having hash conflicts long before hitting the 250 depth limit).
So when I said "--depth=250 --window=250", I chose those numbers more as an example of extremely aggressive packing, and I'm not at all sure that the end result is necessarily wonderfully usable. It's going to save disk space (and network bandwidth - the delta's will be re-used for the network protocol too!), but there are definitely downsides too, and using long delta chains may simply not be worth it in practice.
(And some of it might just want to have git tuning, ie if people think that long deltas are worth it, we could easily just expand on the delta hash, at the cost of some more memory used!)
That said, the good news is that working with *new* history will not be affected negatively, and if you want to be _really_ sneaky, there are ways to say "create a pack that contains the history up to a version one year ago, and be very aggressive about those old versions that we still want to have around, but do a separate pack for newer stuff using less aggressive parameters"
So this is something that can be tweaked, although we don't really have any really nice interfaces for stuff like that (ie the git delta cache size is hardcoded in the sources and cannot be set in the config file, and the "pack old history more aggressively" involves some manual scripting and knowing how "git pack-objects" works rather than any nice simple command line switch).
So the thing to take away from this is:
- git is certainly flexible as hell
- .. but to get the full power you may need to tweak things
- .. happily you really only need to have one person to do the tweaking, and the tweaked end results will be available to others that do not need to know/care.
And whether the difference between 320MB and 500MB is worth any really involved tweaking (considering the potential downsides), I really don't know. Only testing will tell.
Linus
-- 8< --
--- Documentation/config.txt | 5 +++++ Documentation/git-gc.txt | 3 +++ builtin/gc.c | 8 +++++++- 3 files changed, 15 insertions(+), 1 deletion(-)
Documentation/config.txt +5 -0
@@ -1151,6 +1151,11 @@ filter.<driver>.smudge:: object to a worktree file upon checkout. See linkgit:gitattributes[5] for details. +gc.aggressiveDepth:: + The depth parameter used in the delta compression + algorithm used by 'git gc --aggressive'. This defaults + to 250. + gc.aggressiveWindow:: The window size parameter used in the delta compression algorithm used by 'git gc --aggressive'. This defaults
Documentation/git-gc.txt +3 -0
@@ -124,6 +124,9 @@ the value, the more time is spent optimizing the delta compression. See the documentation for the --window' option in linkgit:git-repack[1] for more details. This defaults to 250. +Similarly, the optional configuration variable 'gc.aggressiveDepth' +controls --depth option in linkgit:git-repack[1]. This defaults to 250. + The optional configuration variable 'gc.pruneExpire' controls how old the unreferenced loose objects have to be before they are pruned. The default is "2 weeks ago".
builtin/gc.c +7 -1
@@ -26,6 +26,7 @@ static const char * const builtin_gc_usage[] = { };static int pack_refs =1 ; +static int aggressive_depth =250 ;static int aggressive_window =250 ;static int gc_auto_threshold =6700 ;static int gc_auto_pack_limit =50 ;
@@ -66,6 +67,10 @@ static int gc_config(const char *var, const char *value, void *cb) aggressive_window =git_config_int (var, value);return 0 ; } +if (!strcmp (var,"gc.aggressivedepth" )) { + aggressive_depth =git_config_int (var, value); +return 0 ; + }if (!strcmp (var,"gc.auto" )) { gc_auto_threshold =git_config_int (var, value);return 0 ;
@@ -294,7 +299,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)if (aggressive) {argv_array_push (&repack,"-f" ); -argv_array_push (&repack,"--depth=250" ); +if (aggressive_depth >0 ) +argv_array_pushf (&repack,"--depth=%d" , aggressive_depth);if (aggressive_window >0 )argv_array_pushf (&repack,"--window=%d" , aggressive_window); }
Signature · 1 line
1.9.0.40.gaa8c3ea
A message that is not in the archive (sent off-list or not yet received): CAG+J_Dw=Y5d2JTOngkxH=vNg3C43nP5=y7S6VXS=aHgmBshYZQ@mail.gmail.com
Re: [PATCH 3/4] gc --aggressive: make --depth configurable
Quoted 7 lines · Jay Soffian
Quoted 5 lines · Nguyễn Thái Ngọc Duy
When 1c192f3 (gc --aggressive: make it really aggressive - 2007-12-06) made --depth=250 the default value, it didn't really explain the reason behind, especially the pros and cons of --depth=250.
Quoted 7 lines
Quoted 3 lines
An old mail from Linus below explains it at length. Long story short, --depth=250 is a disk saver and a performance killer. Not everybody agrees on that aggressiveness. Let the user configure it.
Suggestion to link to the email discussion(s) on gmane in the Documentation or at least the commit message?
If you mean the discussion back in 2007, there is a fake header "Gmane-URL" in Linus' mail in the commit message.
Signature · 1 line
Duy
PATCH 4/4 gc --aggressive: three phase repacking
In reply to Nguyễn Thái Ngọc DuyAs 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.
Three more configuration variables are used to make that happen. The first one, gc.aggressiveCommitLimits covers the old history part, which will be tightly packed. The remaining part will be packed with gc.lessAggresiveWindow and gc.lessAggressiveDepth. If gc.aggressiveCommitLimits is empty, everything will be tightly packed as before.
The repack process becomes:
- repack -adf on old history (e.g. the default --before=1.year.ago) mark to keep that pack
- repack the second time with lessAggressive settings, the kept pack should be left untouched.
- remove .keep file and repack the final time, reusing all deltas
This process costs more time, but produce a more effecient pack. It is assumed that people who do "gc --aggressive" do not do this often and do not mind if it takes a bit longer.
git.git is not a great repo to test it because its size is modest but so are my laptop's cpu and memory, so here are the timings and pack sizes
size time old aggr. 36MB 5m51 new aggr. 37MB 6m13 repack -adf 48MB 1m12
--- Documentation/config.txt | 19 +++++++++ builtin/gc.c | 109 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 124 insertions(+), 4 deletions(-)
Documentation/config.txt +19 -0
@@ -1161,6 +1161,25 @@ gc.aggressiveWindow:: algorithm used by 'git gc --aggressive'. This defaults to 250. +gc.aggressiveCommitLimits:: + This one parameter to linkgit:git-rev-list[1] to select + commits that are repacked with gc.aggressiveDepth and + gc.aggressiveWindow, while the remaining commits are repacked + with gc.lessAggressiveDepth and gc.lessAggressiveWindow. ++ +If this is an empty string, everything will be repacked with +gc.aggressiveWindow and gc.aggressiveDepth. + +gc.lessAggressiveDepth:: + The depth parameter used in the delta compression + algorithm used by 'git gc --aggressive' when + gc.aggressiveCommitLimits is set. This defaults to 50. + +gc.lessAggressiveWindow:: + The window size parameter used in the delta compression + algorithm used by 'git gc --aggressive' when + gc.aggressiveCommitLimits is set. This defaults to 250. + gc.auto:: When there are approximately more than this many loose objects in the repository, `git gc --auto` will pack them.
builtin/gc.c +105 -4
157 lines not on this page · raw message
Signature · 1 line
1.9.0.40.gaa8c3ea
Re: [PATCH 4/4] gc --aggressive: three phase repacking
Quoted 5 lines · Nguyễn Thái Ngọc Duy
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)?
Quoted 8 lines
git.git is not a great repo to test it because its size is modest but so are my laptop's cpu and memory, so here are the timings and pack sizes
size time old aggr. 36MB 5m51 new aggr. 37MB 6m13 repack -adf 48MB 1m12
I am not clear on what these times mean. It looks like the new code is slower _and_ bigger. Can you explain them?
-Peff
Re: [PATCH 4/4] gc --aggressive: three phase repacking
Quoted 8 lines · Jeff King
Quoted 5 lines · Nguyễn Thái Ngọc Duy
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.
Quoted 5 lines
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.
---
environment.c +1 -1
@@ -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 ;unsigned long big_file_threshold =512 *1024 *1024 ;const char *pager_program;int pager_use_color =1 ;
sha1_file.c +1 -1
@@ -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)static size_t delta_base_cached;
Re: [PATCH 4/4] gc --aggressive: three phase repacking
Quoted 42 lines · Jeff King
Quoted 8 lines · Jeff King
Quoted 5 lines · Nguyễn Thái Ngọc Duy
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.
Quoted 5 lines
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.172sThe 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.
---
environment.c +0
-0
environment.c int core_compression_seen; · line 40
Quoted 5 lines
environment.c +1
-1@@ -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.
sha1_file.c static void *unpack_compressed_entry(struct packed_git *p, · line 1947
Quoted 13 lines
environment.c +0
-0unsigned long big_file_threshold =512 *1024 *1024 ;const char *pager_program;int pager_use_color =1 ;sha1_file.c +1
-1@@ -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.
Signature · 1 line
David Kastrup
Re: [PATCH 4/4] gc --aggressive: three phase repacking
In reply to Jeff KingQuoted 5 lines · Jeff King
[before]
real 0m28.824s user 0m28.620s sys 0m0.232s
Quoted 8 lines
[after]
real 0m21.694s user 0m21.544s sys 0m0.172sThe 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.
There is definitely room for improvement in delta base cache:
increasing cache size, better eviction strategies.. But I think it's orthogonal to gc --aggressive improvement. From what Linus described ---aggressive is more for archival purposes but I think people have been using it for upstream repos as well. Better packed repos could speed up current clients immediately (although this argument is somewhat flawed, server updates are usually at slower pace than clients..).
Signature · 1 line
Duy
Re: [PATCH 4/4] gc --aggressive: three phase repacking
Quoted 1 line · Duy Nguyen
But I think it's orthogonal to gc --aggressive improvement.
There's another reason that improving gc may be a good idea (or not). It depends on how other git implementations handle long delta chains. If they hate long delta chains like current git too, then more reason to make gc less aggressive.
Signature · 1 line
Duy
Re: [PATCH 4/4] gc --aggressive: three phase repacking
Quoted 5 lines · Duy Nguyen
Quoted 1 line · Duy Nguyen
But I think it's orthogonal to gc --aggressive improvement.
There's another reason that improving gc may be a good idea (or not). It depends on how other git implementations handle long delta chains.
"Other git implementations" including current installations that have a half-life of at last a year.
Signature · 1 line
David Kastrup
A message that is not in the archive (sent off-list or not yet received): CALbm-EbZSuzynXoUNEifP=Ga_mj6Fp9L9Do-mxhRdMvUEfogig@mail.gmail.com
Re: [PATCH 4/4] gc --aggressive: three phase repacking
Quoted 9 lines · Stefan Beller
Maybe we should introduce another option --pack-for-archive which features the characteristics of the old --aggressive. And the new --aggressive would be a tradeoff between space and time?
Thinking further we could add a couple of options there like
--developer-friendly which makes blaming fast --hosting-friendly which makes it most efficient when upstream --archival-friendly (the old --aggressive)
--...
--aggressive-mode=<mode> would be a good option to select those friendly modes instead of a bunch of new options. Well, maby "gc --mode" is enough, we already have two modes: normal and aggressive (or although maybe it should be renamed archive).
Signature · 1 line
Duy
Re: [PATCH 4/4] gc --aggressive: three phase repacking
In reply to Jeff KingQuoted 8 lines · Jeff King
Quoted 5 lines · Nguyễn Thái Ngọc Duy
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.
Quoted 5 lines
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)?
David tested it with git-blame [1]. I should probably run some tests too (I don't remember if I tested some operations last time).
http://thread.gmane.org/gmane.comp.version-control.git/242277/focus=242435
Quoted 11 lines
Quoted 8 lines
git.git is not a great repo to test it because its size is modest but so are my laptop's cpu and memory, so here are the timings and pack sizes
size time old aggr. 36MB 5m51 new aggr. 37MB 6m13 repack -adf 48MB 1m12I am not clear on what these times mean. It looks like the new code is slower _and_ bigger. Can you explain them?
That's right :) The upside is faster operations, which is complely missed here. The good thing from those numbers is pack size does not increase much (the upper limit would be repack -adf with default settings).
Signature · 1 line
Duy
Re: [PATCH 4/4] gc --aggressive: three phase repacking
Quoted 15 lines · Duy Nguyen
Quoted 8 lines · Jeff King
Quoted 5 lines · Nguyễn Thái Ngọc Duy
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.
Quoted 5 lines
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)?
Quoted 4 lines
David tested it with git-blame [1]. I should probably run some tests too (I don't remember if I tested some operations last time).
http://thread.gmane.org/gmane.comp.version-control.git/242277/focus=242435
Ah, thanks. I do remember that thread now.
It looks like David's last word is that he gets a significant performance from bumping the delta base cache size (and number of buckets). And that matches the timings I just did. I suspect there are still pathological cases that could behave worse, but it really sounds like we should be looking into improving that cache as a first step.
-Peff
Re: [PATCH 4/4] gc --aggressive: three phase repacking
Quoted 20 lines · Jeff King
Quoted 18 lines · Duy Nguyen
Quoted 8 lines · Jeff King
Quoted 5 lines · Nguyễn Thái Ngọc Duy
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.
Quoted 5 lines
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)?
David tested it with git-blame [1]. I should probably run some tests too (I don't remember if I tested some operations last time).
Quoted 7 lines
Ah, thanks. I do remember that thread now.
It looks like David's last word is that he gets a significant performance from bumping the delta base cache size (and number of buckets).
Increasing number of buckets was having comparatively minor effects (that was the suggestion I started with), actually _degrading_ performance rather soon. The delta base cache size was much more noticeable. I had prepared a patch serious increasing it. The reason I have not submitted it yet is that I have not found a compelling real-world test case _apart_ from the fast git-blame that is still missing implementation of -M and -C options.
There should be other commands digging through large amounts of old history, but I did not really find something benchmarking convincingly. Either most stuff is inefficient anyway, or the access order is better-behaved, causing fewer unwanted cache flushes.
Access order in the optimized git-blame case is basically done with a reverse commit-time based priority queue leading to a breadth-first strategy. It still beats unsorted access solidly in its timing. Don't think I compared depth-first results (inversing the priority queue sorting condition) with regard to cache results, but it's bad for interactive use as it tends to leave some recent history unblamed for a long time while digging up stuff in the remote past.
Moderate cache size increases seem like a better strategy, and the default size of 16M does not make a lot of sense with modern computers. In particular since the history digging is rarely competing with other memory intensive operations at the same time.
Quoted 3 lines
And that matches the timings I just did. I suspect there are still pathological cases that could behave worse, but it really sounds like we should be looking into improving that cache as a first step.
I can put up a patch. My git-blame experiments used 128M, and the patch proposes a more conservative 64M. I don't actually have made experiments for the 64M setting, though. The current default is 16M.
Signature · 1 line
David Kastrup
Re: [PATCH 4/4] gc --aggressive: three phase repacking
In reply to Duy NguyenQuoted 5 lines · Duy Nguyen
Quoted 5 lines
Quoted 4 lines
size time old aggr. 36MB 5m51 new aggr. 37MB 6m13 repack -adf 48MB 1m12
Quoted 7 lines
Quoted 2 lines
I am not clear on what these times mean. It looks like the new code is slower _and_ bigger. Can you explain them?
That's right :) The upside is faster operations, which is complely missed here. The good thing from those numbers is pack size does not increase much (the upper limit would be repack -adf with default settings).
Something is not right. The performance numbers are against me. Still looking..
Signature · 1 line
Duy
Re: [PATCH 4/4] gc --aggressive: three phase repacking
In reply to Nguyễn Thái Ngọc DuyQuoted 1 line · Nguyễn Thái Ngọc Duy
As explained in the previous commit,...
[PATCH 3/4] becomes a commit with an empty log message for some reason. Have you tried running "am -s" on it?
Re: [PATCH 4/4] gc --aggressive: three phase repacking
Quoted 6 lines · Junio C Hamano
Quoted 1 line · Nguyễn Thái Ngọc Duy
As explained in the previous commit,...
[PATCH 3/4] becomes a commit with an empty log message for some reason. Have you tried running "am -s" on it?
"am -s" worked fine. "am -s --scissors" did not (because of my use of scissors in the commit message). Not sure what happened on your side..
Signature · 1 line
Duy
Re: [PATCH 4/4] gc --aggressive: three phase repacking
Quoted 10 lines · Duy Nguyen
Quoted 6 lines · Junio C Hamano
Quoted 1 line · Nguyễn Thái Ngọc Duy
As explained in the previous commit,...
[PATCH 3/4] becomes a commit with an empty log message for some reason. Have you tried running "am -s" on it?
"am -s" worked fine. "am -s --scissors" did not (because of my use of scissors in the commit message). Not sure what happened on your side..
Yeah, I meant "am -c".