Speed up import #1948
Labels
dependencies
Pull requests that update a dependency file
enhancement
New feature or request
priority
Immediate priority
Milestone
Addressing a Problem?
Import takes 2.5s on my laptop.
Benchmark using
python -X importtime test.py
where test.py is just
import xclim
Potential Solution
xclim.indicators
: 0.1 sxclim.indices
: 0.7 sFor reference, here are import times for some of our dependencies. Note that these numbers are only valid in the xclim context, you'd get different results by testing them individually, since they import each other.
Additional context
Code for lazy import (https://docs.python.org/3/library/importlib.html#implementing-lazy-imports)
Note that if we lazy import indicators, then they're not in the xclim registry. So the virtual module creation, which relies on the registry, would need to trigger their import.
Contribution
Code of Conduct
The text was updated successfully, but these errors were encountered: