Skip to content

perf: lazy-load scipy in metrics and scatter plot#662

Open
ecomodeller wants to merge 1 commit into
mainfrom
perf/lazy-scipy-imports
Open

perf: lazy-load scipy in metrics and scatter plot#662
ecomodeller wants to merge 1 commit into
mainfrom
perf/lazy-scipy-imports

Conversation

@ecomodeller
Copy link
Copy Markdown
Member

Summary

  • Defer scipy.stats import in metrics.py to peak_ratio() (the only function using it at module level).
  • Defer scipy.interpolate import in plotting/_scatter.py to __scatter_density() (the only caller).

Cuts import modelskill from ~3.3s to ~1.45s on my machine. Negligible difference for long-running scripts, but notebook/REPL users feel the snappier startup.

Cuts `import modelskill` from ~3.3s to ~1.45s by deferring scipy.stats
and scipy.interpolate imports to the functions that actually use them.
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