forked from starship/starship
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(package): only try to read files that exist (starship#3904)
* perf(package): only try to read files that exist Have refactored the package module to improve performance. Before this change the module would try to open every single file that could contain some package information until it found a valid version. This resulted in a lot of unneeded disk IO. Have added a new fn, `read_file_from_pwd` that uses the current context to check if that file already exists and fast failing if it doesn't. From my local testing this speeds up the package module from taking ~1ms to ~50µs in an empty directory. * refactor: move read_file_from_pwd to context * refactor(haskell): use read_files_from_pwd * refactor(nodejs): use read_files_from_pwd
- Loading branch information
Showing
4 changed files
with
35 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters