Re: Some git performance measurements..
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:54
Linus Torvalds [off-list ref] writes:
Less than a hundredth of a second may not sound much, but when we have 1700+ directories in the kernel trees, doing that for each possible .gitignore file is really really expensive!
The only thing that wants to use excluded() in the unpack_trees() codepath is the code to allow overwriting an existing, untracked file in verify_absent(). When we find an untracked file at the same path as we are just trying to check out a file, we allow overwriting it only if that file is "ignored". But the way the unpack_trees_rec() and the gitignore handling in dir.c are structured currently means we do push/pop exclude-per-directory stack as we enter and leave a new subdirectory. We do not do this lazily on demand. The newer gitattributes subsystem maintains a similar per-directory data structure but this is purely done on-demand; until somebody asks "what are the attrs for this path", we do not read .gitattributes file. We should be able to restructure exclude-per-directory code in a similar way.