Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

perf(desktop-gpui): build the app crate incrementally with line-table debug info in dev

LukeParkerDevc166ceacaf1b
diff --git a/apps/desktop-gpui/Cargo.toml b/apps/desktop-gpui/Cargo.toml
index 0da906e7a..f484ad240 100644
--- a/apps/desktop-gpui/Cargo.toml
+++ b/apps/desktop-gpui/Cargo.toml
@@ -258,8 +258,8 @@ gpui_tokio = { path = "../../../zed-cap/crates/gpui_tokio" }
# build deps at opt-level 2 and keep the app crate itself at 0.
opt-level = 0
# Incremental caches for this dep tree run to gigabytes on a disk that has
-# already been filled to zero once; a full app-crate recompile at opt-level 0
-# costs about a minute, and `dev.sh` opts back in for its own loop.
+# already been filled to zero once; only the app crate, the one that changes
+# on every edit, opts back in below.
incremental = false
[profile.dev.package."*"]
@@ -275,6 +275,12 @@ debug = "line-tables-only"
[profile.dev.package.cap-gpui-kernels]
opt-level = 3
+# Incremental halves a one-line rebuild for about 2 GB of cache, and line tables
+# cut its codegen and link time; breakpoints and backtraces keep their lines.
+[profile.dev.package.cap-desktop-gpui]
+incremental = true
+debug = "line-tables-only"
+
[profile.release]
lto = "thin"
strip = "symbols"
diff --git a/apps/desktop-gpui/README.md b/apps/desktop-gpui/README.md
index 86b84671a..4cb1e8eff 100644
--- a/apps/desktop-gpui/README.md
+++ b/apps/desktop-gpui/README.md
@@ -18,9 +18,12 @@ cargo run
The first build takes about 11 minutes and 6.4 GB of `target/`: gpui pulls its
own revisions of the wgpu and font stacks. After that, an edit rebuilds only
-the app crate, which stays at `opt-level = 0`: about 75s with `cargo build` and
-35s in the dev loop below. Dependencies build at `opt-level = 2` with line-table
-debug info.
+the app crate, at `opt-level = 0` and incrementally, in about 22s with plain
+`cargo build` or the dev loop below; the app crate's incremental cache is about
+1.6 GB of `target/debug/incremental`. Dependencies build at `opt-level = 2`.
+The app crate and its dependencies carry line-table debug info, so breakpoints
+and backtraces keep their lines; for locals in a debugger, build with
+`--config 'profile.dev.package.cap-desktop-gpui.debug=true'`.
Loops over pixels or samples live in `kernels/` (`cap-gpui-kernels`,
`opt-level = 3`): unoptimised, the editor's frame conversion alone costs 42.7ms
@@ -55,13 +58,8 @@ waits out an in-flight recording rather than truncating it (the state file
doubles as that handshake — `dev.sh` will not kill the app while it reads
`"recording":true`).
-The loop exports `CARGO_INCREMENTAL=1`, overriding this profile's
-`incremental = false` for its own builds only: a one-line edit to the app crate
-rebuilds in about 35s instead of 75s.
-The costs are the ones the profile comment warns about, scoped down: a few GB
-of `target/debug/incremental` (delete it to reclaim), and a one-off app-crate
-rebuild when switching between `./dev.sh` and a plain `cargo build`, whose
-flags differ.
+The loop runs a plain `cargo build`, so it shares every artifact with one run
+by hand: switching between `./dev.sh` and `cargo build` rebuilds nothing.
### Why it is a separate workspace
diff --git a/apps/desktop-gpui/dev.sh b/apps/desktop-gpui/dev.sh
index 6dc4290aa..7e6ce384b 100755
--- a/apps/desktop-gpui/dev.sh
+++ b/apps/desktop-gpui/dev.sh
@@ -79,7 +79,7 @@ while true; do
if [ "$CURRENT" != "$LAST" ]; then
LAST="$CURRENT"
echo "[dev] building..."
- if "$BUILD" build --config profile.dev.package.cap-desktop-gpui.incremental=true; then
+ if "$BUILD" build; then
if [ -n "$APP_PID" ] || gpui_owns_session || instance_live; then
stop_app
start_app