You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
Activity
jozefchutka commentedon Nov 24, 2022
Please keep in mind some files might not be available during the startup, but created later during the app runtime.
jimmywarting commentedon May 22, 2023
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
kripken commentedon May 22, 2023
I think WasmFS+JSPI is definitely worth doing in some form. @brendandahl and @tlively were thinking about this IIRC.