Skip to content

Conversation

@frazane
Copy link
Owner

@frazane frazane commented Jul 31, 2025

Refactors numba gufuncs to be lazily/dynamically compiled, with the exception of a few common functions which will still be compiled eagerly during import. This brings a significant improvement in terms of import time: on my (fairly slow) machine, it goes from 19s to 3s. Closes #80.

@frazane frazane requested a review from sallen12 July 31, 2025 12:49
"void(float64[:], float64[:,:], float64[:])",
],
"(d),(m,d)->()",
cache=True,
Copy link
Collaborator

@sallen12 sallen12 Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't fully understand the motivation for caching the energy score gufunc but not the other gufuncs imported at import time, e.g. (fair and nrg) crps and variogram score?

The weighted interval score is also cached but lazily loaded. Again, why this score and not the other scores?

Copy link
Collaborator

@sallen12 sallen12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks! I have made one comment on caching of the gufuncs (why particular gufuncs have been cached and not others), but it is more for my understanding rather than something that needs fixing.

@sallen12 sallen12 merged commit e373933 into main Aug 4, 2025
8 checks passed
"nrg": _crps_ensemble_nrg_gufunc,
"pwm": _crps_ensemble_pwm_gufunc,
"int": lazy_gufunc_wrapper_uv(_crps_ensemble_int_gufunc),
"nrg": lazy_gufunc_wrapper_uv(_crps_ensemble_nrg_gufunc),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nrg estimator could also be lazily loaded - currently it also has the longer decorator, as if it is not lazily loaded

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.

Numba gufuncs slowing down import (due to eager mode compilation)

3 participants