Re: [PATCH] sha1_name: cache readdir(3) results in find_short_object_filename()

2017-06-24 Thread Jeff King
On Sat, Jun 24, 2017 at 04:09:39PM +0200, René Scharfe wrote: > Am 24.06.2017 um 14:20 schrieb Jeff King: > > On Sat, Jun 24, 2017 at 02:12:30PM +0200, René Scharfe wrote: > > > >>> That's redundant with "subdir_nr". Should we push that logic down into > >>> the function, and basically do: > >>>

Re: [PATCH] sha1_name: cache readdir(3) results in find_short_object_filename()

2017-06-24 Thread René Scharfe
Am 24.06.2017 um 14:20 schrieb Jeff King: > On Sat, Jun 24, 2017 at 02:12:30PM +0200, René Scharfe wrote: > >>> That's redundant with "subdir_nr". Should we push that logic down into >>> the function, and basically do: >>> >>> if (subdir_nr < 0 || subdir_nr > 256) >>> BUG("object subdir nu

Re: [PATCH] sha1_name: cache readdir(3) results in find_short_object_filename()

2017-06-24 Thread Jeff King
On Sat, Jun 24, 2017 at 02:12:30PM +0200, René Scharfe wrote: > > That's redundant with "subdir_nr". Should we push that logic down into > > the function, and basically do: > > > >if (subdir_nr < 0 || subdir_nr > 256) > > BUG("object subdir number out of range"); > > Hmm. I don't expect

Re: [PATCH] sha1_name: cache readdir(3) results in find_short_object_filename()

2017-06-24 Thread Jeff King
On Sat, Jun 24, 2017 at 02:12:07PM +0200, René Scharfe wrote: > Am 23.06.2017 um 01:10 schrieb Jeff King: > > On Thu, Jun 22, 2017 at 08:19:48PM +0200, René Scharfe wrote: > > > >> Read each loose object subdirectory at most once when looking for unique > >> abbreviated hashes. This speeds up co

Re: [PATCH] sha1_name: cache readdir(3) results in find_short_object_filename()

2017-06-24 Thread René Scharfe
Am 23.06.2017 um 01:10 schrieb Jeff King: > On Thu, Jun 22, 2017 at 08:19:48PM +0200, René Scharfe wrote: > >> Read each loose object subdirectory at most once when looking for unique >> abbreviated hashes. This speeds up commands like "git log --pretty=%h" >> considerably, which previously cause

Re: [PATCH] sha1_name: cache readdir(3) results in find_short_object_filename()

2017-06-24 Thread René Scharfe
Am 23.06.2017 um 01:10 schrieb Jeff King: > On Thu, Jun 22, 2017 at 08:19:48PM +0200, René Scharfe wrote: >> @@ -1811,6 +1822,12 @@ typedef int each_loose_cruft_fn(const char *basename, >> typedef int each_loose_subdir_fn(int nr, >> const char *path, >>

Re: [PATCH] sha1_name: cache readdir(3) results in find_short_object_filename()

2017-06-22 Thread Jeff King
On Thu, Jun 22, 2017 at 08:19:48PM +0200, René Scharfe wrote: > Read each loose object subdirectory at most once when looking for unique > abbreviated hashes. This speeds up commands like "git log --pretty=%h" > considerably, which previously caused one readdir(3) call for each > candidate, even

[PATCH] sha1_name: cache readdir(3) results in find_short_object_filename()

2017-06-22 Thread René Scharfe
Read each loose object subdirectory at most once when looking for unique abbreviated hashes. This speeds up commands like "git log --pretty=%h" considerably, which previously caused one readdir(3) call for each candidate, even for subdirectories that were visited before. The new cache is kept unt