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

JS glue code to lazily run wizer in browser after first load #45

Open
comods opened this issue Feb 16, 2022 · 2 comments
Open

JS glue code to lazily run wizer in browser after first load #45

comods opened this issue Feb 16, 2022 · 2 comments

Comments

@comods
Copy link

comods commented Feb 16, 2022

There are concerns with the emscripten Godot project that the snapshot will increase bandwidth usage too much. (emscripten support is a separate issue)

For the subset of programs that:

  1. Wizer unreasonably increases bandwidth usage.
  2. Want fast page refreshes.

I believe the following would fix the bandwidth problem without undo start delay.

  1. Project Devs code their WASM's start function for wizer use.
  2. Project Devs use a small wizer JS wrapper to request the instance of the wasm module.
  3. Wrapper just passes through to any cached wasm module the following steps created.
  4. If there isn't a cache, instantiate the downloaded wasm.
  5. Run the deterministic start function.
  6. Send a snapshot of the instance's memory to a web worker.
  7. Run the remaining non-deterministic start function then return the instance like wizer wrapper didn't exist.
  8. Lazily in the webworker, download wizer compiler.
  9. Lazily use the snapshot to create a new stripped wasm module and save it into indexeddb.

If even step 6 is too much, then:

  1. Skip copying the snapshot in step 6 when loading the webpage for the first time.
  2. Lazily in the web worker create an entirely separate wasm module and start again from Step 4.
@fitzgen
Copy link
Member

fitzgen commented Feb 16, 2022

Hi @RefinedSoftwareLLC,

Is this supposed to be a question? A feature request? As written, this issue is just a statement and I'm not sure what kind of response you are seeking.

@comods
Copy link
Author

comods commented Feb 16, 2022

It is an idea and pseudo code for a feature request who's usefulness might not be assessable til wizer works with emscripten and a game engine's wasm like Godot or Unity.

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

2 participants