Skip to content

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