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
Add a mode where we persist the changes made to a chunked disk image in
the origin private file system feature that is supported by modern browsers.
They also support being able to get a synchronous file handle, which allows
us to directly intercept read/write calls from the emulator with no complications.
The persistence is handled as an overlay on top of the chunked data, we have a
separate dirty chunks bitmask that stores which chunks have been modified. When
we're about to read from a chunk, we first load it from the persisted disk.
Similarly, when a change to a chunk is made, we mark it as dirty and write it
to the persisted disk. This does mean that there is some write amplification
(any change writes a whole 256K chunk), but in practice performance appears to
be OK (the native file system cache kicks in presumably).
Since the disk image is mostly empty, we stored it compressed in Git (to avoid
having a large file). We also optimize empty chunks, so that we don't need to
store a signature for them, or load them over the network.
To feature detect if the browser supports the origin private file system and
synchronous file handles, we need to create a temporary worker (FileSystemSyncAccessHandle
is only ever defined in workers). We cache the result of this check in
localStorage so that we don't need to do it too often.
Currently disabled by default, but accessible via the custom instance
dialog or the ?saved_hd=true query parameter
Updates #152
0 commit comments