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

Lazily load project submodules #1052

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Lazily load project submodules #1052

wants to merge 10 commits into from

Conversation

Beforerr
Copy link
Contributor

@Beforerr Beforerr commented Nov 1, 2024

pyspedas.mission and pyspedas.project.mission still work but now lazily loaded
import pyspedas.mission is not supported however.

This pull has breaking changes so we maybe merge it for v2.0

#1050

@Beforerr
Copy link
Contributor Author

Beforerr commented Nov 1, 2024

Similar things could be done for analysis modules if desired

@Beforerr
Copy link
Contributor Author

Beforerr commented Nov 1, 2024

Benchmark shows that first loading speed improve about 0.5s and average 0.15s

❯ hyperfine "python -c 'import pyspedas'"

Benchmark 1: python -c 'import pyspedas'
  Time (mean ± σ):      1.541 s ±  0.236 s    [User: 2.535 s, System: 0.287 s]
  Range (min … max):    1.421 s …  2.205 s    10 runs
 
  Warning: The first benchmarking run for this command was significantly slower than the rest (2.205 s). This could be caused by (filesystem) caches that were not filled until after the first run. You should consider using the '--warmup' option to fill those caches before the actual benchmark. Alternatively, use the '--prepare' option to clear the caches before each timing run.
Benchmark 1: python -c 'import pyspedas'
  Time (mean ± σ):      1.401 s ±  0.152 s    [User: 2.520 s, System: 0.266 s]
  Range (min … max):    1.301 s …  1.788 s    10 runs
 
  Warning: The first benchmarking run for this command was significantly slower than the rest (1.788 s). This could be caused by (filesystem) caches that were not filled until after the first run. You should consider using the '--warmup' option to fill those caches before the actual benchmark. Alternatively, use the '--prepare' option to clear the caches before each timing run.
 

@Beforerr
Copy link
Contributor Author

Beforerr commented Nov 1, 2024

image

Now the mainly loading cost comes from pytplot and mms compareed to previous #1050 (comment)

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