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

Optimizing PortalBase #59

Open
makermelissa opened this issue Feb 17, 2022 · 5 comments
Open

Optimizing PortalBase #59

makermelissa opened this issue Feb 17, 2022 · 5 comments

Comments

@makermelissa
Copy link
Contributor

Sooo, PortalBase was never optimized. Thus it has gotten a bit bloated. It was designed with compatibility of old code in mind, and to that end it succeeded, but the library could be revamped to be smaller and more functional. I actually didn't think it would be used as heavily when I originally made a version for the MatrixPortal and then the other boards.

One of the major problems with the bloat is that it pushes many of the boards to their memory limits and I currently have a PR in place to freeze the library into CircuitPython. However, by making it smaller, this would free up some room on there.

Some of optimizing would be doing things like stripping out debug which is really unnecessary at this point and was a holdover from the original PyPortal library. Other things would be stripping out things like the "init everything at once approach" that was also a holdover from the original PyPortal library. It would mostly be writing the code to be more efficient and would likely be largely the same to the average user. I do really like the approach that was made with most of the boards in terms of adding text and would likely stick with that for the most part.

Before doing anything with this, I would like to hear other people's opinions.

@ladyada
Copy link
Member

ladyada commented Feb 17, 2022

id like to init things more on use, because right now pyportal on esp32s2 also takes a long time to boot

@makermelissa
Copy link
Contributor Author

I like that idea.

@dastels
Copy link
Collaborator

dastels commented Feb 17, 2022

Lazy initialization is a great idea. Especially if it means that you can not copy over support modules that you aren't using. As it is now you have to have everything copied over whether you want it or not.

@makermelissa
Copy link
Contributor Author

Lazy initialization is a great idea. Especially if it means that you can not copy over support modules that you aren't using. As it is now you have to have everything copied over whether you want it or not.

Great point

@makermelissa
Copy link
Contributor Author

I think some of that can be handled in each of the board-specific libraries since the peripherals file does a lot of the loading. However, if you never use network functions for instance, there's no reason to load up requests, which is handled here.

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

No branches or pull requests

3 participants