On Thu, Nov 08, 2018 at 08:58:19PM +0000, Geert Jansen wrote: > On Thu, Nov 08, 2018 at 07:02:57AM -0500, Jeff King wrote: > > > Yes, testing and review. :) > > > > I won't send the series out just yet, as I suspect it could use another > > read-through on my part. But if you want to peek at it or try some > > timings, it's available at: > > > > https://github.com/peff/git jk/loose-cache > > I gave this branch a go. There's a performance regression as I'm getting a > clone speed of about 100 KiB/s while with the previous patch I got around 20 > MiB/s. The culprint appears to be a very large number of stat() calls on > ".git/objects/info/alternates". The call stack is: > > -> quick_has_loose() > -> prepare_alt_odb() > -> read_info_alternates() Heh, indeed. Try this on top: diff --git a/sha1-file.c b/sha1-file.c index bc35b28e17..9ff27f92ed 100644 --- a/sha1-file.c +++ b/sha1-file.c @@ -692,6 +692,7 @@ void prepare_alt_odb(struct repository *r) link_alt_odb_entries(r, r->objects->alternate_db, PATH_SEP, NULL, 0); read_info_alternates(r, r->objects->odb->path, 0); + r->objects->loaded_alternates = 1; } /* Returns 1 if we have successfully freshened the file, 0 otherwise. */ -Peff