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

improve top-level import speed with deferred imports #2394

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sbailey
Copy link
Contributor

@sbailey sbailey commented Oct 15, 2024

This PR addresses several import speed issues identified in #2379, especially for desispec.io.

desispec.io: deferring imports of specutils, speclite.filters, and desispec.preproc improves "import desispec.io" from 4.1 seconds to 1.3 seconds (best of 5, pwd on scratch). The remaining time is dominated by importing astropy.table (1.0 sec), which would be messy to defer everywhere.

desispec.tsnr: deferring import astropy.convolution improves "import desispec.tsnr" from 2.9 to 2.3 sec. Remaining big imports are astropy.table and astropy.coordinates via desiutil.dust.

desispec.pixgroup: removing unused import healpix improves "import desispec.pixgroup" from 3.7 to 3.15 sec. Remaining big imports are desispec.tsnr (could be deferred, though this is a bit messy since TSNR is re-calculated on-the-fly if columns are missing from older data)

@coveralls
Copy link

Coverage Status

coverage: 30.186% (-0.006%) from 30.192%
when pulling 5fabf40 on import_speed
into 05bcd76 on main.

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