Michael Haggerty <mhagger@xxxxxxxxxxxx> 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 > applicable to the `packed-refs` file. As far as I understand, the file > mmapped in `index_fd()` is always read in full, whereas the main point > of mmapping the packed-refs file is to avoid having to read the whole > file at all in some situations. That being said, a 32 KiB file would > only be 8 pages (assuming a page size of 4 KiB), and by the time you've > read the header and binary-searched to find the desired record, you've > probably paged in most of the file anyway. Reading the whole file at > once, in order, is almost certainly cheaper. Yup. So unless your "small" is meaningfully large, we are likely to be better off with read(2), but I suspect that this might not be even measuable since we are only talking about "small" files.