Skip to content

WIP: Fix: Command was too slow to launch #351

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

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

Conversation

hoh
Copy link
Member

@hoh hoh commented Mar 4, 2025

Solution: Use lazy imports to reduce import time

Typer becomes the main dependency not lazy loaded.

This makes the code more complex, but in my
observation the CLI could launch in 0.4 seconds
instead of almost 2 seconds.

PYTHONPROFILEIMPORTTIME=1 python src/aleph_client/__main__.py 2> import.log ; tuna import.log

Without optimizations, in battery saving mode, typing aleph takes ~3.5 seconds.
image

Solution: Use lazy imports to reduce import time

Typer becomes the main dependency not lazy loaded.

This makes the code more complex, but in my
observation the CLI could launch in 0.4 seconds
instead of almost 2 seconds.
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