-
Notifications
You must be signed in to change notification settings - Fork 592
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 load time for the CLI client #2170
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it is only a draft, but I think it would be worth to merge those proposals, Added some comments
"""Set the active sketch. | ||
|
||
Args: | ||
ctx: Click CLI context object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just stumbled across this PR, any reason you removed the docstring here?
This PR refactors how we do imports in the CLI client. The current implementation has some slow imports (the API client with cloud dependencies etc). The way Click works is it imports all commands at startup.
By moving the imports in the commands to inline with the function we lazy import when needed. This speeds up the UI significantly.
I also refactored the state object, moving initializing the API client and config assistant to properties instead, with the ability to cache the objects (for commands that access them multiple times).
These changes reduced time to load the tool from ~1.4s -> ~0.2s. Making the tool much snappier to use.
import
toupload
to make it more intuitive.