Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] faster (or lazy) module import #146

Closed
jeertmans opened this issue Mar 5, 2023 · 0 comments · Fixed by #147
Closed

[FEATURE] faster (or lazy) module import #146

jeertmans opened this issue Mar 5, 2023 · 0 comments · Fixed by #147
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

Comments

@jeertmans
Copy link
Owner

Description

Currently, Manim Slides' CLI is quite slow due to an import overhead caused by importing manim or manimlib, 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 and logger, 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:
image

Additional information

Lazy module import is only planned to be part of Python 3.12, see PEP0690, so an alternative solution should be found.

@jeertmans jeertmans added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers dependencies Pull requests that update a dependency file labels Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant