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

Make imports faster? #7

Open
chaithyagr opened this issue Jun 27, 2023 · 2 comments
Open

Make imports faster? #7

chaithyagr opened this issue Jun 27, 2023 · 2 comments
Assignees

Comments

@chaithyagr
Copy link
Member

For now imports seem really slow, make it faster for faster debug cycles

@chaithyagr chaithyagr self-assigned this Jun 27, 2023
@paquiteau
Copy link
Member

Are you still facing this issue ?

@paquiteau paquiteau closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2023
@paquiteau
Copy link
Member

paquiteau commented Jul 3, 2024

So I am facing this issue now (using multiprocessing) I have made some basic profiling using tuna for the visualization.

As we can see, the loading time is mostly due to external libraries (torch, sigpy, matplotlib and sigpy) are in the top three.

However, after this initial import there is no extra cost (import are cached internally by python)

Several possibilities:

Related stuff:
https://stackoverflow.com/questions/4177735/best-practice-for-lazy-loading-python-modules
https://wiki.python.org/moin/PythonSpeed/PerformanceTips#Import_Statement_Overhead

Reproducing the profiling:

python -X importtime -c "import mrinufft"  2> import.log
tuna import.log

image

@paquiteau paquiteau reopened this Jul 3, 2024
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

No branches or pull requests

2 participants