git-ls is slow because it takes a long time for git to tell us when each file was last modified.
If I stored an index of file -> mtime, and also the hash of the most recent commit where it was valid, then getting mtimes could follow this process:
If the current hash is the same as the stored last index, use the indexed mtimes
Otherwise:
i. simple solution: invalidate the whole cache and recalculate mtimes
ii. maybe faster solution: check commits from the last cache to current HEAD, update the mtimes of all files touched by those commits
git-ls
is slow because it takes a long time for git to tell us when each file was last modified.If I stored an index of file -> mtime, and also the hash of the most recent commit where it was valid, then getting mtimes could follow this process: