Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce Startup Execution Time #1459

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Reduce Startup Execution Time #1459

wants to merge 1 commit into from

Conversation

cyuria
Copy link

@cyuria cyuria commented Aug 23, 2024

Reduces the impact of #1428

Nearly half of the startup time of running thefuck -a is caused by the removed line of code in thefuck/system/unix.py. This line of code imports find_executable from distutils, 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.

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.

@cyuria
Copy link
Author

cyuria commented Aug 23, 2024

It looks like this might conflict with #1404

I'd prefer that get merged over this PR, however I will leave this open until one of these two does get merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant