Repository navigation
Build a checkout run's catalog apps in the background - #549
Merged
Merged
Conversation
Run from a checkout, a process app's first open waits for its release build: Makepad's pdf app took 1 min 38 s cold on a quiet M-series Mac (120 crates), route 110 s more, and minutes under load. The shell now runs those same builds once in the background, 20 s after it starts (prebuild.rs), so the first open finds the binary built: pdf's first frame came 3.3 s after the launch instead. - Each listed catalog app's own launch build (clients::launch_plan and build_command, now pub(crate)), each identical build once, in catalog order, one at a time. - Background priority: darwinbg on macOS (efficiency cores, throttled disk), nice 19 elsewhere, below normal on Windows; its own process group. - It steps aside for a launch: the WM counts building launches every tick (ClientSlot::building); the prebuild then stops its cargo group, waits, and starts that build again, cargo keeping what it finished. - Event::Shutdown stops it (prebuild::shutdown), group and all. - An installed shell has no build and never starts it; MAKEPAD_WM_NO_PREBUILD=1 turns it off (desktop README, both languages). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ymote
marked this pull request as ready for review
October 20, 2026 01:19
Contributor
Author
|
Local CI passed on 86e164c ( GitHub would run for this PR: desktop.yml, phone.yml, apps.yml. Merged on this local pass (macOS runner queue); GitHub CI runs on the merge commit on main.
Skipped (these did NOT pass; (!) marks a skip that blocks tools/ci-local-merge.sh):
Notes:
|
This was referenced Oct 20, 2026
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.
Why
Run from a checkout, opening a catalog process app the first time waits for its release build (
clients::launch_plan:cargo build --release) before the app starts. Measured on an M-series Mac:An installed shell compiles nothing (its apps are linked modules, or binaries beside it), so this only affects development and demo runs. It is still every run of OctoSense from a source tree.
What
crates/shell/src/prebuild.rsruns those same builds once, in the background, 20 s after the shell starts. A first open then finds its binary built.clients::launch_plan's build step throughclients::build_command(nowpub(crate)): same args, environment allow-list andPATH. Each identical build runs once, one at a time, in catalog order.nice 19on other Unix, below normal on Windows.ClientSlot::building).prebuild: waiting while a launch buildsand… stepped aside for a launch's build.Event::Shutdowncallsprebuild::shutdown, which kills the running build's group.MAKEPAD_WM_NO_PREBUILD=1, documented in the desktop README in both languages. An installed shell has no build step, so it never starts.Verified (macOS 26, Apple silicon)
cargo test --locked --features mobile-apps -p octosense-shell --lib prebuild(fromphone/): 4/4.MAKEPAD_WM_ROOTset to it, a fresh test profile, catalog apps building into an empty target dir.prebuild: 15 catalog apps build in the background, then15 of 15 built in 1486 sat background priority. Per app: reference 345 s (the shared crates), browser 402, route 289, files 142, pdf 100, the rest 11–34 s.MAKEPAD_WM_TEST_APP=pdf, the log readspdf client 1 first frame in 3290 ms.15 of 15 built in 74 s(up-to-date checks).MAKEPAD_WM_TEST_APP=calculator, the prebuild loggedwaiting while a launch buildsuntil Calculator started (first frame 53 s, its cold build), then went on./quitleft no cargo and no rustc behind.wait_or_step_asidewith the quit path, which was.prebuild::shutdownonly marks the worker stopped, and its child ends when the worker sees it.🤖 Generated with Claude Code