Skip to content

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

Draft
hoh wants to merge 1 commit into
masterfrom
hoh-optimize-launch-time
Draft

WIP: Fix: Command was too slow to launch#351
hoh wants to merge 1 commit into
masterfrom
hoh-optimize-launch-time

Conversation

@hoh
Copy link
Copy Markdown
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