Skip to content

Visual Studio Code, rebuilt in Rust

Rust

docs(notes): record the first benchmark against Zed 1.30.2

rokartur08fa02e1caca
diff --git a/docs/performance.md b/docs/performance.md
index 77c5c6382d8..ba2d7543f87 100644
--- a/docs/performance.md
+++ b/docs/performance.md
@@ -2,7 +2,7 @@
"Fast" is a property the project checks, not a hope. This file has the budgets the port holds today, the rules that keep hot paths fast, how to measure, and the gates that fail on a regression. [ARCHITECTURE.md](../ARCHITECTURE.md) has the map of the code.
-The targets are two editors. VS Code 1.148.0 is the floor: the port must not be worse on a budget, and one budget is ([idle CPU](#whole-app-measured-from-outside)). Zed is the bar for a native editor: the port must be at the same level or better. That comparison has no measurement yet ([Zed](#zed)).
+The targets are two editors. VS Code 1.148.0 is the floor: the port must not be worse on a budget, and one budget is ([idle CPU](#whole-app-measured-from-outside)). Zed is the bar for a native editor: the port must be at the same level or better. The port is behind Zed on peak memory and RSS ([Zed](#zed)).
## Budgets
@@ -41,12 +41,9 @@ Terminal throughput, terminal typing latency, time to open a large file, search
### Zed
-There is no measurement against Zed. Two things are missing:
+Zed 1.30.2 is installed on the Studio (`/Applications/Zed.app`), and `port/tools/bench` runs it with its own arguments through `port/tools/bench-zed`. The first run, with the numbers, the definitions for Zed and the command, is in `port/notes.md` ("Benchmarks", Zed comparison). In that run the port is level with Zed on footprint at 90 s and idle CPU, ahead on CPU until ready and quit, and behind on peak footprint (489 against 378 MiB) and RSS (752 against 560 MiB peak, 363 against 270 MiB at 90 s).
-- `port/tools/bench` gives each app VS Code's arguments (`--disable-workspace-trust`, `--extensions-dir`). Zed does not take them, so the tool needs the arguments per app.
-- Zed is not installed on the machine that runs the benchmark.
-
-With both, one run of `port/tools/bench` with the two apps gives the medians of each. `port/tools/bench-check.ts <run.tsv> <app> <reference>` then fails where the port is behind the reference in that run. The `against` object of `port/budgets.json` holds a ratio per reference and metric for a difference that is a decision. Frame times need a second method, because the headless tests of the port do not run Zed: the same scroll input in both windows and a sample of the main thread of each.
+`bun port/tools/bench-check.ts <run.tsv> vsrustium zed` fails where the port is behind Zed in one run. The `against` object of `port/budgets.json` holds a ratio per reference and metric for a difference that is a decision. Frame times need a second method, because the headless tests of the port do not run Zed: the same scroll input in both windows and a sample of the main thread of each.
## Rules for hot paths
diff --git a/port/notes.md b/port/notes.md
index 1b407e2a843..28fe207ab1f 100644
--- a/port/notes.md
+++ b/port/notes.md
@@ -958,6 +958,29 @@ What to do (milestone 21, in order):
- Scroll frame costs in the GUI (branch port-fix-settings-scroll): the release app on the Studio host lane over the same folder, a scratch Swift CGEvent probe posting 30px continuous scroll events at about 100 Hz, and a scratch timer in `Window::draw`, give the frame times the headless harness gives; tracing `Context::notify` callers with `#[track_caller]` found who draws the Workbench. An inlay-hint answer called the Workbench's `cx.notify()`, so every part drew again on 78 of 87 scroll frames; with no provider registered a scroll still sent a request, whose answer came at once. The answer now notifies the editor view, and no provider means no request (inlayHintsController.ts:189). The overview ruler then took 80 to 120 ms a frame: with the cursor on `export`, a word on every line of the 20000, `word_highlight_ruler_lines` looked each of the 20000 highlights' kind up by a scan of the 20000 document highlights; one map per frame now. Editor in the GUI after both: median 10.5 / p95 11.8 ms (450 frames), its main thread in taffy `layout_as_root` 24%, `key_context` 14%, `editor_lines` 10%, the highlights map 9%. The Studio's accessibility client turns on "Screen Reader Optimized". On the lane `screencapture` fails ("could not create image from display"); `cua-driver call get_window_state` with `screenshot_out_file` works. A bare `wait` in a script that started the app in the background waits for the app.
- The Studio mirror of this branch had an `out-exthost` from Nov 23 that `port/tools/build-exthost` had not inlined (its `BUILD_INSERT_PRODUCT_CONFIGURATION` markers still there), so the extension host asked for `../product.json` and failed to start; `bun port/tools/build-exthost` in the mirror fixed it. The bundle is not affected: build-exthost inlines the product and package-app writes `product.json` into the app.
- Scroll frame costs, the second GUI round (branch port-fix-settings-scroll): logging `Context::notify` callers on the Workbench with `#[track_caller]` while scrolling each surface found two more answers that redrew every part: a file decoration answer (137 times in an Explorer scroll up) and a gallery icon (149 times in the Extensions @builtin list). Each answer now notifies the view that drew the asking label or row (`window.current_view()` at the request), so every view that draws labels sends its own decoration requests at the end of its render: the Workbench root, each cached part view and each editor window. The Explorer's frame then showed the collapsed Outline (17%, a clone of the whole outline model) and Timeline (13%, its menu's context keys) building bodies the pane view drops; they now return their header only while `is_view_visible` is false. Settings opens on the lane through a user keybinding (`f19` to `workbench.action.openSettings2`, a plain key the probe posts), where the probe's Cmd+, and Cmd+Shift+P did not reach the app. It opens as the modal editor (with `workbench.editor.useModal` `off` too), and in two runs a scroll over it moved the text editor below (line 36 to 2508) while the settings list stayed at Commonly Used, so the GUI cannot measure Settings until the modal takes the wheel (ledger workbench/parts/editor). Cause: `swapped_group_body`'s guard took the wheel, press and move of an inactive group in the capture phase by its bounds, under the modal's overlay too; it now asks its hitbox, which the overlay's `occlude` hides (cargo test -p app a_wheel_over_the_settings_modal_scrolls_the_settings_list), and Settings follows `useModal` `off`.
+- How others compare Zed and VS Code, before measuring ours: (1) Zed's team (zed-industries/zed#2040, 2023) filmed the screen with Is It Snappy and took 10 samples less 2 outliers: startup until restored buffers are highlighted, typing latency, tab switching, and footprint after the language server loaded. It measures pixels the user sees, but by hand: the thread asked how to script it and got no answer. (2) Typometer (pavelfatin/typometer) posts keystrokes and reads screen pixels: typing latency only. (3) Zed's own tools (zed.dev/docs/performance: samply, Tracy, the task profiler) profile Zed from inside and cannot run another app. `port/tools/bench` stays: scripted, the same outside measurement for any macOS app, the whole process tree, medians over alternating runs. None of the three is better for what it measures; Typometer is the candidate for typing latency, which `bench` does not measure.
+- Zed comparison (Zed 1.30.2 stable, the official darwin-aarch64 build from zed.dev, notarized, in `/Applications/Zed.app` on the Studio): one run of `port/tools/bench` with VSRustium (release build and `port/tools/package-app` of 3a73e3dfa53, main then), VS Code 1.148.0 and Zed, 5 runs after one warm-up, alternating, on the Studio host lane on 2026-12-01 from 22:07. Zed takes none of VS Code's arguments, so `bench` passes its own to a command that names `$FOLDER`: `port/tools/bench-zed "$BENCH_DATA" "$FOLDER"` writes `{"disable_ai": true, "auto_update": false, "telemetry": {"diagnostics": false, "metrics": false}}` to `<data dir>/config/settings.json` (where Zed reads it with `--user-data-dir`) and execs `zed --user-data-dir <data dir> <folder>`. Definitions for Zed are the ones of the other two: window is launch to the first on-screen layer-0 window wider than 400 pt of the launched process (a fresh data dir opens the workspace window titled `vscode-ref-1.148.0`, no onboarding, checked with System Events; for all three it is the window in the window server's list, not proof that its first frame has content); ready is the start of the first 2 s with the tree under 10% of a core, which for Zed includes the scan of the 21,627 files and git; memory is the tree of `zed` and its children (git; no language server starts, as no file is open). Zed has no extension host process (extensions run as wasm in `zed`), so `exthost_mib` is 0 and only whole-tree rows compare. The load was high: the bench waited 30 min for a 1-minute load under 20 and did not get one (20.8 to 74.6), and the runs had 16.3 to 67.7; memory pressure stayed normal (level 1), compressor 2.1 to 2.7 GiB, swap 1.8 GiB.
+
+ | median (min to max) | VSRustium | VS Code 1.148.0 | Zed 1.30.2 |
+ |---|---|---|---|
+ | window | 1.16 s (0.87 to 2.88) | 1.24 s (0.46 to 2.61) | 1.34 s (0.39 to 1.91) |
+ | ready | 3.44 s (2.57 to 9.23) | 12.98 s (4.75 to 14.01) | 2.93 s (1.57 to 3.80) |
+ | CPU until ready | 2.69 s (2.46 to 3.22) | 8.82 s (6.95 to 10.26) | 3.41 s (2.67 to 3.91) |
+ | idle CPU, 60 to 90 s | 0.4% (0.4 to 0.5) | 0.3% (0.2 to 0.5) | 0.4% (0.4 to 0.6) |
+ | peak footprint | 489 MiB (472 to 509) | 1072 MiB (1032 to 1157) | 378 MiB (374 to 404) |
+ | peak RSS | 752 MiB (730 to 781) | 1779 MiB (1764 to 1881) | 560 MiB (555 to 632) |
+ | footprint at 90 s | 222 MiB (221 to 227) | 581 MiB (581 to 585) | 225 MiB (224 to 228) |
+ | RSS at 90 s | 363 MiB (360 to 364) | 1426 MiB (1419 to 1587) | 270 MiB (269 to 271) |
+ | quit | 0.15 s (0.12 to 0.26) | 0.23 s (0.18 to 23.81) | 0.33 s (0.28 to 0.49) |
+ | 1-minute load | 31.5 (21.5 to 60.9) | 26.3 (16.3 to 67.7) | 28.7 (16.8 to 57.9) |
+
+ The port is behind Zed on peak footprint by 111 MiB (29%), peak RSS by 192 MiB (34%) and RSS at 90 s by 93 MiB (34%); footprint at 90 s and idle CPU are level, CPU until ready (21% less) and quit are ahead. The times are no result at this load: the port's ready is 0.51 s behind at the median with two runs at 8.45 and 9.23 s (loads 31.5 and 60.9), and in the quietest run (run 5, load 16 to 22) its window came at 0.93 s against Zed's 0.39 and VS Code's 0.46, so window and ready against Zed need a quiet machine. VS Code's quit of 23.81 s in run 4 is one sample. `bun port/tools/bench-check.ts run.tsv vsrustium zed` on this run: BEHIND on `peak_footprint_mib` and `peak_rss_mib`, `window_s` over its budget at load 31.5. Not measured: typing latency, scroll frames and memory with files open (language servers) in Zed. The command, on the Studio host lane after the release build and package-app, VS Code unpacked in `/tmp/vscode`:
+
+ ```
+ FOLDER=$HOME/Developer/vscode-ref-1.148.0 SETTINGS='{"chat.disableAIFeatures": true}' \
+ APPS='vsrustium=native/target/VSRustium.app/Contents/MacOS/vsrustium;vscode="/tmp/vscode/Visual Studio Code.app/Contents/MacOS/Code" --disable-extension GitHub.copilot-chat;zed=port/tools/bench-zed "$BENCH_DATA" "$FOLDER"' \
+ port/tools/bench > run.tsv
+ ```
## GUI lanes (Studio)