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

NF: Add lazy_loader feature in FURY #907

Merged
merged 1 commit into from
Jul 30, 2024
Merged

Conversation

WassCodeur
Copy link
Member

This pull request introduces the lazy_loader feature to optimize module loading in the FURY . Lazy loading improves performance by deferring the loading of modules until they are actually needed, thus reducing startup times and memory footprint.

Changes included in this PR:

  • Implementation of lazy loading across multiple modules in FURY.
  • Updated __init__.py files to support lazy loading where necessary.
  • Added type stubs (__init__.pyi) to provide type indications for lazy loading modules.
  • Improved module organization and structure to effectively support lazy loading.

This feature aims to improve the user experience by speeding up application start-up and improving overall performance in scenarios where not all modules are immediately required.

@WassCodeur WassCodeur requested a review from skoudoro July 4, 2024 14:58
@skoudoro
Copy link
Contributor

Thank you for this. Can you rebase ?

@deka27
Copy link
Contributor

deka27 commented Jul 13, 2024

Hi @WassCodeur , why does this have the keyword decorator commit?
Also, I believe you should have a look at the lazy loading implementation in Scikit-Image.
You will have to make changes in pyproject.toml

https://github.com/fury-gl/fury/blob/43540d3534e907241c84969915d38a072d2ee66c/pyproject.toml#L44C1-L52C2

@WassCodeur
Copy link
Member Author

Hi @deka27!
Thank you. By the way, I had created the lazy_loader branch from the keyword_only branch. Thanks a lot for the reminder to update the pyproject.toml.

@deka27
Copy link
Contributor

deka27 commented Jul 13, 2024

Okay, I understand. I feel you could have implemented as a new feature branch only (it will be tough to review both features at once, so u might need to rebase properly).
Also u might need py.typed file (this is so that type_stub files are compiled properly).

@WassCodeur WassCodeur force-pushed the lazy_loader branch 2 times, most recently from 53617b3 to ad3f44d Compare July 13, 2024 14:11
@WassCodeur
Copy link
Member Author

Okay, thanks a lot @deka27 . I'll look into integrating py.typed.

Copy link
Contributor

@skoudoro skoudoro left a comment

Choose a reason for hiding this comment

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

Hi @WassCodeur,

Thank you for this! I tried and it works like a charm. I compared performance using python -X importtime -c "import fury; import fury.lib" 2>import.log and I see improvement so it is ready to go.

merging

@skoudoro skoudoro merged commit d3aa7d8 into fury-gl:master Jul 30, 2024
15 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants