hercules-ci / gitignore.nix

Nix functions for filtering local git sources
The Unlicense
245 stars 20 forks source link

Try to avoid readDir where pathExists may suffice #32

Open roberth opened 4 years ago

roberth commented 4 years ago

@grahamc

it looks like if the gitignore lib used builtins.pathExists instead of readDir to find .gitignore and .git dir entries, it would be much more optimally performant with lorri since it usesreadDir we effectively have to trigger new evaluations any time the list of files in a directory changes whereas a pathExists call we can be much more precise about the watch behavior

Most of the IO there is written with memoization in mind I don't see a reason right now why we can't do a pathExists before some readDirs so that seems worthwhile to investigate

roberth commented 4 years ago

@Profpatsch @grahamc I was able to eliminate some readDirs, see #33

Could you check whether this solves the problem?

Profpatsch commented 4 years ago

@curiousleo says he can’t reproduce: https://github.com/target/lorri/issues/245#issuecomment-559117471

update: he can’t reproduce even before this change. I’ll take a look.