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 load time for the CLI client #2170

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft

Reduce load time for the CLI client #2170

wants to merge 16 commits into from

Conversation

berggren
Copy link
Contributor

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.

  • Further more, some cleanup of help messages, and the renaming of import to upload to make it more intuitive.

@berggren berggren marked this pull request as draft April 14, 2022 10:11
@berggren berggren changed the title Reduce load time for the CLI client [DRAFT] Reduce load time for the CLI client Apr 14, 2022
@berggren berggren self-assigned this Jan 3, 2023
Copy link
Collaborator

@jaegeral jaegeral left a 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.
Copy link
Collaborator

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?

@berggren berggren changed the title [DRAFT] Reduce load time for the CLI client Reduce load time for the CLI client Jul 13, 2023
@berggren berggren added this to the Release: 20231206 milestone Oct 30, 2023
@justzh

This comment was marked as spam.

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

Successfully merging this pull request may close these issues.

4 participants