[FEATURE] faster (or lazy) module import #146
Labels
dependencies
Pull requests that update a dependency file
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
Description
Currently, Manim Slides' CLI is quite slow due to an import overhead caused by importing
manim
ormanimlib
, even though most of it is not needed.Calling
manim-slides --help
takes more than 1s on my computer, when 90+ % of the time taken for importing useless modules.However, manim-like dependencies are only ever needed when rendering slides, thus in
manim_slides/slides.py
.The only attributes that are used across all tools are
FFMPEG_BIN
andlogger
, but those could be easily created apart, and eventually read options from CLI's arguments if configuration is needed (such as specifying ffmpeg's path).A solution to this should be found, allowing for a faster CLI.
Screenshots
Snakeviz visualization when calling
manim-slides --help
:Additional information
Lazy module import is only planned to be part of Python 3.12, see PEP0690, so an alternative solution should be found.
The text was updated successfully, but these errors were encountered: