Repository navigation
Open a built app without waiting for cargo - #552
Merged
Merged
Conversation
From a checkout, every process app's open ran its release build first, and cargo's up-to-date check alone loads the whole workspace: 0.6-2 s for an app already built, 8 s for the first open after the shell starts, the larger part of each open (measured 21 Oct 2026 under everyday load). A successful build (a launch's or the prebuild's) now leaves a record beside its binary: the exact command. An open starts the binary at once when that record covers it and nothing the build read is newer: every file in cargo's dep-info for the binary (the sources and included files of every path crate it links), those crates' manifests, the checkout's manifest and lock, cargo's config and toolchain files, and the cargo and rustc it runs. Anything newer, missing or unrecorded runs the build as before; the prebuild's run of the same build catches what the comparison cannot see (a build script's own inputs, a changed environment). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From a checkout, opening an already-built app no longer waits for cargo. The app starts as soon as the shell's own build is known to have made the binary and nothing that build read has changed since.
Why
From a checkout, every process app's open ran
cargo build --releasefirst, even when the binary was current. Cargo's up-to-date check alone loads the whole workspace. Measured here on 21 Oct 2026, under this Mac's everyday load (another session's build, a backup client, a VM):That was 35–85% of each open. Reopening apps felt slow even after #549 had built everything.
What changes
clients::note_built: a successful build leaves a record beside its binary,<bin>.octosense-build, holding its exact command. Builds that write it: a launch's build, including one whose launch was closed meanwhile (ClientSlot::continue_launch), and the prebuild's (prebuild::run).clients::build_is_fresh, checked byspawn_client. The binary starts at once (log:wm: <app>: built and unchanged since; it starts without cargo) when two things hold:<bin>.d: the sources and included files of every path crate it links), each of those crates'Cargo.toml, the checkout's manifest and lock, cargo's config and toolchain files on the way up from the build's directory, and the cargo and rustc it runs.It costs a few thousand
stats. Anything newer, missing or unrecorded runs the build exactly as before, with the "building…" tile and progress.What the comparison cannot see (a build script's own inputs, a changed environment, a toolchain swapped in place): the prebuild runs the same build in the background after every start, so a stale binary is rebuilt and recorded for the next open. A binary someone else rebuilt (a manual
cargo build, maybe with other features) is newer than the record, so the shell's build runs again.BuildStepgainsprogram, the binary it produces.PendingAppkeeps itsBuildStep.Docs:
prebuild.rsmodule docs and theMAKEPAD_WM_NO_PREBUILDrow in both desktop READMEs.The sandbox is unchanged: a native app still starts under its policy. The target dir stays read-only to sandboxed apps, so no app can write a record. The six Makepad catalog apps aren't sandboxed (as before).
Measured
One hidden shell per app (
MAKEPAD_WM_TEST_APP, prebuild off), the same demo profile, every app already built. Times are from the launch gesture to the app's first frame on the desk (wm: <app> client N first frame in N ms):Calculator, Clock, Notes, Reminders and Weather open in-process on macOS, with no build either way.
The second-run logs show the fast path for every app; Sheets' sandbox line is still there. The edit loop still builds first: after a
touchofapps/image/src/main.rs, the next Image open ran cargo (Compiling makepad-image … Finished in 2.18s, first frame 3723 ms). The open after that started without cargo again (332 ms).Testing
phone/:cargo test --locked --features mobile-apps -p octosense-shell --lib -- clients::tests octosense::catalog::tests prebuild::tests sandbox::tests: 71 passed. That includes:a_binary_newer_than_everything_its_build_read_starts_without_cargo: no record, then a record; a newer source, an included file with an escaped space, the crate manifest, the lock, the workspace manifest and the toolchain each force the build; a different command; a binary rebuilt after the record; a deleted input; no dep-info.a_launch_starts_its_app_only_after_a_successful_build, now also checking that a successful build is recorded, a failed one is not, and a closed launch's successful build is.cargo build --locked -p octosense, then the timings above.tools/ci-local.sh --only all --linux-host --offload): to follow.std::fsmodification times, and the unit tests run on the Linux CI jobs.This touches
clients.rsin places #551 doesn't, so the two merge in either order.🤖 Generated with Claude Code