-
Notifications
You must be signed in to change notification settings - Fork 103
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
Preloading modules for performant and isolated evaluation #193
Comments
quickjs itself provides functions to read and write bytecode, including function bytecode. This is used by the We already have a few routines that can load and store "bjson" values, which calls down to I'm not sure to what extent your time is spent on parsing code. If the majority of the time is parsing, then pre-parsing could result in a big speedup. When it comes to module/runtime/context:
As for WASM memory layout, I'm not sure what to say. I don't understand how Emscripten's This is specifically how JSRuntime and JSContext are related: |
Thank you for the wealth of info @justjake. I'll take a bit of time to absorb and do some more reading. From my first read, it sounds like an approach might be to include my module ( At that point I can retest by passing that new wasm module as a quickjs-emscripten 'variant' and monitor the initialisation time again to see how it's performing. Out of interest did you create the diagram or is that from somewhere you could link to (it seems like that could be a good place for me to learn further)? |
I drew the diagram in tldraw |
Hey,
Firstly thank you for the amazing project.
I'm interested in learning more about how to improve performance when loading external modules. I'm very new to wasm in general so please bear with me.
The context is that I'm wanting to preload js modules, then execute lots of short-lived scripts (which themselves don't need to import anything), each script should run in isolation.
I'm loading modules (a minified/bundled version of
Intl
) into the (js) global context. This is working using thesetModuleLoader
and allows doing things likeNumber(1).toLocaleString('en')
.However it takes a decent amount of time to parse and load the module (which is a couple of MB) for each script. This approach feels really heavyweight.
Is there a way to preload js modules such that each new context has them available but is still secured?
Some ideas which seem related but I don't yet have the knowledge to pursue are:
Intl
).I'm finding this difficult to reason about given my lack of understanding of how memory is laid out in wasm and how that relates to this project's concepts of 'context' or 'runtime' isolation.
Would love to hear any suggestions or ideas that you have for this project? Thanks!
The text was updated successfully, but these errors were encountered: