Download raw body.
reduce the reallocarray() calls in read_fileindex_path()
On Fri, Jul 28, 2023 at 10:52:25AM +0200, Omar Polo wrote: > We spend a decent amount of time reading the fileindex in > reallocarray(). The fileindex has the path stored (NUL included) with > a final padding to the next multiple of eight bytes, so we read 8 > bytes per iteration. That's fine. Calling reallocarray() to increase > the size of the allocation by 8 byte each iteration however is a > waste. > > Instead, use a local buffer and strdup() on exit. > > Git paths don't have an implicit length limit, but this is the > fileindex of a worktree and AFAIK we can't check-out files whose path > is more than PATH_MAX anyway. > > ok? Yes, ok. There could be Git repositories out there which overflow our PATH_MAX. IIRC the path length is not limited in Git's on-disk format. But such repositories could only be used with a path-prefix anyway, which would generally be quite impractical.
reduce the reallocarray() calls in read_fileindex_path()