Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

build: `cargo dev` runs the window in twenty seconds, not three minutes

Jareer6495f1f69967
diff --git a/src/.cargo/config.toml b/src/.cargo/config.toml
index 0fae32c9..ba66476b 100644
--- a/src/.cargo/config.toml
+++ b/src/.cargo/config.toml
@@ -4,10 +4,15 @@
# at an unpacked shared build. Set those in your own environment, never
# here - a machine path committed to this file breaks every other checkout.
-# No incremental caches. They are a speed-up for the second build of one
-# crate and a tax on the disk for everything else: a session of edits across
-# the workspace leaves tens of gigabytes of them behind. The shipping builds
-# run on GitHub Actions; a machine here needs `cargo check` and the tests of
-# the crates it is changing, and those are quick without.
-[build]
-incremental = false
+# No incremental caches for the dev and test profiles: they are a speed-up
+# for the second build of one crate and a tax on the disk for everything
+# else, and a session of edits across the workspace leaves tens of
+# gigabytes of them behind. That is set per profile in Cargo.toml rather
+# than as `build.incremental` here, because the config key overrides every
+# profile - it was silently switching off the `quick` profile's
+# incremental, which is the one build that wants it.
+
+# `cargo dev`: the window, built to try a change in. See `[profile.quick]`
+# in Cargo.toml for what it is and why it is quick.
+[alias]
+dev = "run --bin concat --profile quick"
diff --git a/src/Cargo.toml b/src/Cargo.toml
index fbe5587d..b833704b 100644
--- a/src/Cargo.toml
+++ b/src/Cargo.toml
@@ -52,7 +52,8 @@ opt-level = 3
lto = "thin"
codegen-units = 1
-# For trying a change in the window: `cargo run --profile quick -p concat`.
+# For trying a change in the window: `cargo dev` (an alias for
+# `cargo run --bin concat --profile quick`, see .cargo/config.toml).
# Optimised enough that video plays as it would in release, without the
# thin LTO and single codegen unit that make a release rebuild a
# minutes-long relink. Incremental, so a change in one crate is seconds.
@@ -62,6 +63,23 @@ lto = false
codegen-units = 16
incremental = true
+# The window's own crate unoptimised. It is where every edit lands, and
+# most of it is the Slint compiler's output: one enormous module that the
+# front end takes fifty-odd seconds to check and that LLVM then took two
+# minutes over at level 3 - and, measured, the same two minutes at level
+# 1, since the time is a few huge generated functions and not the level.
+# At 0 that is ten seconds. With the profile's incremental honoured (see
+# .cargo/config.toml) a Rust edit rebuilds in twenty seconds and a .slint
+# edit in twenty-five, from three minutes twenty. The engine crates keep
+# the profile's level 3: decoding and compositing are theirs, and they
+# only rebuild when they change. What this crate does itself - publish the
+# lanes, run the panes, format a waveform - is light enough that nothing
+# on screen tells the difference; if something ever does, the shipping
+# build is `--profile app`.
+[profile.quick.package.concat]
+opt-level = 0
+codegen-units = 256
+
# The shipping build of the editor window: `cargo build --profile app -p concat`.
#
# Every knob here is set for the fastest possible binary, and each one costs
@@ -101,3 +119,11 @@ strip = "symbols"
# the rest of the engine is being debugged.
[profile.dev.package."*"]
opt-level = 2
+
+# No incremental caches for the everyday check-and-test builds; see
+# .cargo/config.toml for why it is said here and not there.
+[profile.dev]
+incremental = false
+
+[profile.test]
+incremental = false