Skip to content

WasmFS: Pre-open OPFS files #17161

Open
Open

Description

@tlively

For the OPFS backend in particular, reading and writing (and potentially other operations, depending on what happens with the APIs) are synchronous, but it takes some asynchronous work to acquire the necessary handles first. If we could "pre-open" files on a main application thread by doing that asynchronous work during startup, then we would be able to synchronously read and write the files from that thread without any further proxying.

Activity

  1. moved this to Todo in WasmFSon Jun 6, 2022
  2. added this to the WasmFS new features milestone on Jun 6, 2022
  3. jozefchutka commented on Nov 24, 2022

    @jozefchutka

    Please keep in mind some files might not be available during the startup, but created later during the app runtime.

  4. jimmywarting commented on May 22, 2023

    @jimmywarting

    how about using JSPI (aka asyncify -2) that can suspend web assembly?
    Then this issue won't feel as much as important anymore.

    Feels like that should be the recommended way as it would allow it to run in the main thread where sync access handle are not available and couldn't be suspended with Atomics + SharedBuffer either as it isn't always running in a worker thread

    With JSPI you would not have to suggest ppl to pre open a handles in order to get the the sync access handle to do sync read/write/flush as OPFS currently is a hole mix of sync and async

    the JSPI could even work on other async backends such as IndexedDB among others

  5. kripken commented on May 22, 2023

    @kripken
    Member

    I think WasmFS+JSPI is definitely worth doing in some form. @brendandahl and @tlively were thinking about this IIRC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status
      Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions