Re: [PATCH v3] packed_ref_cache: don't use mmap() for small files

2018-01-24 Thread Junio C Hamano
Michael Haggerty writes: > The change to using `read()` rather than `mmap()` for small > `packed-refs` feels like it should be an improvement, but it occurred to > me that the performance numbers quoted in ea68b0ce9f8 (hash-object: > don't use mmap() for small files, 2010-02-21) are not directly

Re: [PATCH v3] packed_ref_cache: don't use mmap() for small files

2018-01-24 Thread Michael Haggerty
On 01/22/2018 08:31 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> `snapshot->buf` can still be NULL if the `packed-refs` file didn't exist >> (see the earlier code path in `load_contents()`). So either that code >> path *also* has to get the `xmalloc()` treatment, or my third patch is

Re: [PATCH v3] packed_ref_cache: don't use mmap() for small files

2018-01-22 Thread Junio C Hamano
Michael Haggerty writes: > `snapshot->buf` can still be NULL if the `packed-refs` file didn't exist > (see the earlier code path in `load_contents()`). So either that code > path *also* has to get the `xmalloc()` treatment, or my third patch is > still necessary. (My second patch wouldn't be nece

Re: [PATCH v3] packed_ref_cache: don't use mmap() for small files

2018-01-20 Thread Michael Haggerty
On 01/17/2018 11:09 PM, Jeff King wrote: > On Tue, Jan 16, 2018 at 08:38:15PM +0100, Kim Gybels wrote: > >> Take a hint from commit ea68b0ce9f8 (hash-object: don't use mmap() for >> small files, 2010-02-21) and use read() instead of mmap() for small >> packed-refs files. >> >> This also fixes the

Re: [PATCH v3] packed_ref_cache: don't use mmap() for small files

2018-01-17 Thread Jeff King
On Tue, Jan 16, 2018 at 08:38:15PM +0100, Kim Gybels wrote: > Take a hint from commit ea68b0ce9f8 (hash-object: don't use mmap() for > small files, 2010-02-21) and use read() instead of mmap() for small > packed-refs files. > > This also fixes the problem[1] where xmmap() returns NULL for zero >

[PATCH v3] packed_ref_cache: don't use mmap() for small files

2018-01-16 Thread Kim Gybels
Take a hint from commit ea68b0ce9f8 (hash-object: don't use mmap() for small files, 2010-02-21) and use read() instead of mmap() for small packed-refs files. This also fixes the problem[1] where xmmap() returns NULL for zero length[2], for which munmap() later fails. Alternatively, we could simpl