-
Notifications
You must be signed in to change notification settings - Fork 513
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
Goldilocks brython.js #117
Comments
+1 Sometimes I have thought in creating something like http://www.highcharts.com/download so a user can choose what they need. I need to find the way to see how to manage the recurrent imports of libs online. |
any other feedback on this? Pierre? |
we definitely need to look for ways to decrease the file sizes. A few months ago, I moved the unittest package (and modules unittests) to a py_unittests.js file which is similar to VFS. Most users are not going to use these on a site, so why include them in VFS? I think we should do the same for other modules and see what makes sense to include. |
As mentioned in issue #123, we could refactor the VFS functionality to support multiple files - this could be "common.json" for example |
… , "browser.html" and "javascript". Related to issue #117
In the commit referenced above I have introduced a new script, builtin_modules.js, which is included in brython.js. It makes the modules "browser", "browser.html" and "javascript" available without having to fetch and run the source code. Technically, they are inserted in the object As a consequence, the modules local_storage, session_storage, and object_storage are not loaded with the module "browser", so the names LocalStorage, SessionStorage and ObjectStorage are not defined as attributes of the browser module, and neither is WebSocket. To use local storage and web sockets, the syntax will be the one that is documented, ie from browser import local_storage I don't think it's a major issue : in fact I was not comfortable with the fact that there were 2 ways to interact with local storage, one with the code above and another with This change doesn't cover all that was suggested in this issue, but it can be a starting point to reduce the loading time of frequently used modules. |
The current brython.js is too small. I have to load a bunch of files almost all the time.
brython_dist.js or brython.js + VFS is too big. I don't need every single library!
But goldilocks... is just right.
This suggestion is to change the brython.js build to be like VFS except it will use these files:
And change the look-up logic so that it checks for included libs, and then checks the staticlibs.
i.e.
The import_from_VFS function is quite cheap, so I don't see any point in not doing it.
The idea is that these are the files that people will probably use or the site uses. Any other files will be imported normally.
I've already half-way written the code, just need some input/confirmation before I put the effort into polishing it and making a merge request.
Extra file size ends up only being 94kb
The text was updated successfully, but these errors were encountered: