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

perf: make ape run --help faster #2364

Merged
merged 6 commits into from
Nov 4, 2024
Merged

Conversation

antazoey
Copy link
Member

@antazoey antazoey commented Nov 1, 2024

What I did

ape run --help was still slow because of a few reasons, mostly was the project access that i may look into on another PR.

How I did it

Use Path.cwd() / "scripts"` locally.
Localize some imports as well.

Note: if you have a script module that is just slow to load, this wont help that ofc

How to verify it

(in a project with zero scripts)

BEFORE:

ape run --help  4.47s user 0.99s system 98% cpu 5.542 total

AFTER:

ape run --help  0.29s user 0.09s system 59% cpu 0.638 total

With scripts is also much faster, but you wil only be as fast as your slowest script to load in a project. CLI users should have the same knowledge that lazy imports are better for CLIs.

Checklist

  • All changes are completed
  • New test cases have been added
  • Documentation has been updated

@antazoey antazoey enabled auto-merge (squash) November 4, 2024 15:11
@antazoey antazoey merged commit 0a227e1 into ApeWorX:main Nov 4, 2024
16 checks passed
@antazoey antazoey deleted the perf/lazy-run branch November 4, 2024 16:53
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.

2 participants