Performance: fs.opendir stats every file in a directory, I believe. We only need to stat names that match .config or civetconfig.*. I've restructured to use fs.readdir which just gets the listing, and only stat files we care about. On some file systems, this can be orders of magnitudes faster.
Also, stat can throw, and we can't really catch that from fs.opendir. MIT's UNIX machines use AFS (Andrew File System) which is ... particular. The parent directory of my home directory has 500 subdirectories, and some of them fail to stat. In particular, every time I run the Civet CLI (without --no-config) I get this error:
Performance:
fs.opendir
stats every file in a directory, I believe. We only need to stat names that match.config
orcivetconfig.*
. I've restructured to usefs.readdir
which just gets the listing, and only stat files we care about. On some file systems, this can be orders of magnitudes faster.Also,
stat
can throw, and we can't really catch that fromfs.opendir
. MIT's UNIX machines use AFS (Andrew File System) which is ... particular. The parent directory of my home directory has 500 subdirectories, and some of them fail to stat. In particular, every time I run the Civet CLI (without--no-config
) I get this error:(where
xxx
is the parent of my home directory)With this PR, I can finally run the CLI on these machines without
--no-config
😄