Skip to content

Commit 48a8af8

Browse files
committed
docs: expand macOS I/O performance guidance with VirtioFS option
The previous section only documented named volumes as a solution to gRPC FUSE latency. VirtioFS is a simpler, zero-configuration baseline that benefits the whole workspace mount — worth documenting alongside the volume preset approach. - Rename section to 'I/O Performance on macOS' for clarity - Document VirtioFS (Option 1) with setup steps and tradeoffs - Reframe named volumes as Option 2, complementary to VirtioFS - Add tradeoff summary for each option and a combined recommendation
1 parent 2e5e18a commit 48a8af8

1 file changed

Lines changed: 32 additions & 3 deletions

File tree

README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,34 @@ opencode-sandbox --build .
8989
opencode-sandbox . -- --version
9090
```
9191

92-
### Volume Presets
92+
### I/O Performance on macOS
9393

94-
On macOS, Docker Desktop mounts the workspace via **gRPC FUSE**, a userspace filesystem that adds latency to every file operation. This is particularly noticeable for:
94+
On macOS, Docker Desktop mounts the workspace via **gRPC FUSE**, a userspace filesystem that proxies every file operation over a gRPC socket to the host. The round-trip overhead is noticeable for anything that touches many files:
9595

9696
- `node_modules` — thousands of small files read during startup and builds
9797
- `target/` — large Rust build artifacts with frequent stat/mtime checks
9898
- `~/.cargo/registry` and `~/.cargo/git` — Cargo dependency cache
9999
- `~/go/` — Go module cache and compiled packages
100100

101-
The `-V`/`--volume-preset` flag mounts named Docker volumes over these directories instead. Named volumes live on the Linux VM's native ext4 filesystem and bypass gRPC FUSE entirely, giving significantly faster build and install times.
101+
There are two complementary ways to improve this.
102+
103+
#### Option 1: Enable VirtioFS in Docker Desktop
104+
105+
VirtioFS replaces gRPC FUSE with a shared-memory transport, significantly reducing filesystem latency across the entire workspace mount — no code or flag changes needed.
106+
107+
To enable it: **Docker Desktop → Settings → General → Virtual file sharing implementation → VirtioFS**, then apply and restart.
108+
109+
VirtioFS is not enabled by default; you must opt in regardless of hardware. It requires Docker Desktop 4.6 or later.
110+
111+
**Tradeoffs:**
112+
- ✅ Zero application changes — improves the whole workspace transparently
113+
- ✅ Better file watcher reliability (Vite HMR, webpack watch mode)
114+
- ⚠️ Still slower than a native Docker volume for the highest-churn directories
115+
- ⚠️ macOS only (Linux hosts use the host kernel directly and are unaffected)
116+
117+
#### Option 2: Named volumes with `-V`/`--volume-preset`
118+
119+
The `-V`/`--volume-preset` flag mounts named Docker volumes over specific high-churn directories. Named volumes live on the Linux VM's native ext4 filesystem and bypass gRPC FUSE (or VirtioFS) entirely, giving the best possible I/O for build artifacts.
102120

103121
| Preset | Volumes mounted | Scope |
104122
|---|---|---|
@@ -112,6 +130,17 @@ The `-V`/`--volume-preset` flag mounts named Docker volumes over these directori
112130
113131
Use `--clean` to remove the workspace-scoped volumes for the current workspace (useful when you need a completely fresh `node_modules` or `target`). Shared volumes (Cargo registry, GOPATH) are never removed by `--clean`.
114132

133+
**Tradeoffs:**
134+
- ✅ Fastest possible I/O for the covered directories — native ext4, no translation layer
135+
- ✅ Works regardless of which file sharing backend Docker Desktop is using
136+
- ⚠️ Volume contents are not visible on the host filesystem
137+
- ⚠️ Volumes must be populated on first use
138+
- ⚠️ Per-workspace volumes consume disk space in the Docker VM; use `--clean` to reclaim it
139+
140+
#### Recommendation
141+
142+
Enable **VirtioFS** as a baseline — it improves the whole workspace for free. Then add **`-V` presets** for the specific directories where you're doing heavy build work. The two options stack.
143+
115144
### API Keys
116145

117146
API keys are read from your shell environment. Set them however you normally would (`.bashrc`, `.zshrc`, a secrets manager, `direnv`, etc.). Keys are passed into the container via a temporary `--env-file` (not `-e` flags) so they don't appear in host process listings. The following variables are passed through when set:

0 commit comments

Comments
 (0)