Observation: on the machine where I write, a rebuild takes seconds; after git pull on the other machine, dx serve (desktop) takes 1 767 s. Is there a reason, and a way to cut it?
Answer (2026-09-21) — what a desktop dx serve does here, measured on this machine (8 cores, 30 GB):
It is two full builds. A fullstack desktop app builds the client (the moonkale binary, 1.8 GB in debug) and the server (target/dx/moonkale/debug/web/server, 1.7 GB) — every workspace crate twice, with different features, and two links of a gigabyte-plus binary each. The release equivalents are 193 MB and 188 MB; the difference is debug info.
Feature changes rebuild almost everything. The Milestone 11 commit made tokio a non-optional dependency of api with more features, and added axum-server, rustls, tokio-rustls, reqwest (remote). Any change to the feature set of a crate as central as tokio recompiles it and everything above it — hyper, reqwest, axum, dioxus-server, the LLM client, … — i.e. most of the 991 crates. A pull that changes Cargo.toml features costs a near-clean build; a pull that changes only Rust source costs seconds. (A clean release desktop build here: 361 s; the debug clean build with its two gigabyte links is what you saw.)
The shared target/ thrashes. (dx compiles the desktop client into target/debug, the same directory cargo test/clippy use.) dx serve, cargo test -p <crate>, cargo clippy, the web build and the server build all write target/debug with different feature unifications: it held 178 GB, 15 727 files in deps/, and 2 370 incremental directories (46 GB) when measured — each combination keeps its own artefacts and switching between them re-links. My own checks and tests now use CARGO_TARGET_DIR=target/agent, so they never invalidate what your dx serve built.
What cuts it (in order of effect):
Less debug info. In the root Cargo.toml:
[profile.dev]debug = "line-tables-only" # backtraces with file:line, ~4× smaller binaries, far faster links[profile.dev.package."*"]debug = false # no debug info for dependencies at all
Applied 2026-09-21 and measured: a clean debug desktop build (client + server, 1 084 crates, while a browser test batch ran on the same 8 cores) took 399 s and the binaries came out at 449 MB + 470 MB instead of 1.8 GB + 1.7 GB. That full build is already in target/debug on this machine, so the next dx serve here starts from a warm cache; on the other machine the first pull after this costs one full build. Set debug = 2 back for a session in which you need to step through a dependency in a debugger.
Keep Cargo.lock and features stable between pulls where possible; a feature change on a leaf crate is cheap, on tokio/serde/dioxus it is the whole tree.
Don’t mix invocations in one target/: give scripts and tests their own CARGO_TARGET_DIR (done for the agent’s runs); cargo clean when target/ passes a few hundred GB.
Linker: rustc 1.98 already uses rust-lld on x86_64 Linux, so mold gains little; sccache would carry compiled dependencies between the two machines (cargo install sccache, RUSTC_WRAPPER=sccache) — not set up.
Long term: the server half is only needed on desktop for remote mode’s client code, not as a second binary; a desktop build without the fullstack server build is a dioxus configuration question (P-101).