Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reduces the impact of #1428
Nearly half of the startup time of running
thefuck -a
is caused by the removed line of code inthefuck/system/unix.py
. This line of code importsfind_executable
fromdistutils
, however this import takes on the order of 40% of the total startup time. This means my personal startup time has been reduced from about 400ms to 250ms or so as seen in the below image.I've attempted to find further ways of reducing this time, but bar from fully isolating the entire chain of functions, it looks like this isn't particularly feasible.
One thing I haven't tried is to use lazy importing of some kind. This could yield serious performance improvements, as most of the delays are caused by
import
statements which, for the most part, aren't used by the--alias
code path, however are not possible to easily move or remove due to their numerous quantity and interlinked dependencies in just about every source file. Transitioning to lazy loading would likely take a fair bit of effort to make sure everything still works and there is still no guarantee of better performance, however it is a possible avenue to continue down.