Startup time #3677
-
Simply importing
➡️ 1.2129588
➡️ 0.1960905 I've used seaborn 0.13.2, matplotlib 3.8.3, and Python 3.12.2 for this quick comparison. Running
While ugly, using lazy imports for those would already cut the startup time in half, with little effort. The first invocation of an API element that needs those imports would be slower, of course, but if they are never used, there's no cost at all. Maybe a library like import apipkg
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._column import Column
apipkg.initpkg(__name__, {
"Column": "._column:Column",
})
__all__ = [
"Column",
] Are lazy imports, at least for a few packages, an option for you at all, or do you want to load everything upfront? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
👎 on a new dependency that said, the widget stuff can probably just get deprecated, I am not sure anyone uses it. but matplotlib and pandas and numpy are huge; I am not sure I buy that the marginal import time of seaborn itself is that significant. |
Beta Was this translation helpful? Give feedback.
-
Are you sure of your results ? The |
Beta Was this translation helpful? Give feedback.
-
Also |
Beta Was this translation helpful? Give feedback.
Also
ipywidgets
andscipy
are both optional dependencies so if you're doing something like building a container environment where fast startup is important, you could just not include them.