diff options
author | Roman Bataev <roman@bataev.me> | 2023-08-06 16:40:23 -0400 |
---|---|---|
committer | Roman Bataev <roman@bataev.me> | 2023-08-21 22:30:00 -0400 |
commit | c5b2e50b8907555538f52356fc04b2a5820b5c6f (patch) | |
tree | 41e9e9b9a0c231f2c86819804b0b6d9bc16823fb /plumbing/object/object.go | |
parent | cd6170c6f808453f58dcfd15c6c59345e3df402b (diff) | |
download | go-git-c5b2e50b8907555538f52356fc04b2a5820b5c6f.tar.gz |
utils: filesystem, Calculate filesystem node's hash lazily.
The main motivation behind this change is to speed up status operation.
Currently it's very slow, especially for repositories with lots of ignored
files (e.g. node.js repository with node_modules directory).
One of the reasons for this slowness is the fact that traversing filesystem
involves calculating file hashes for all files, even if those hashes are
not needed in the end because the files are in gitignore.
On my machine, for a random repository with sizable (ignored) node_modules
directory this changes bring the execution time for Worktree.Status
from ~3.5s to ~1.4s. This is still very slow, but a significant improvement.
A better fix (instead of or in addition to this one) would be to avoid traversing
ignored files in the first place. However, such change seem to be more
intrusive and will require much deeper understanding of the codebase.
Diffstat (limited to 'plumbing/object/object.go')
0 files changed, 0 insertions, 0 deletions