Skip to content

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

@comods

Description

@comods

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions