feat(phase-1/m5.5): perf pass legs --perf-smoke/--perf-verify; M5 closed

Seeds 3000 notes against the real streaming UI (279 ms total, ~0.09 ms/note),
fresh observeAll 70 ms, favorite toggle 1 ms, reopen first non-empty emission
89 ms; only 4 RENDER lines during the seed (size-keyed emission coalesces).
The multi-thousand-note unknown from the Phase-0 recommendation closes:
desktop perf is a non-event at 3000 notes. §7 marked DONE + handoff
"first actions" rewritten for post-M5 sessions (four pending-MANUAL checks
listed).

Verify: :desktopApp:run --args="--data-dir /tmp/incido-perf --perf-smoke
--exit-after 150" (PERF seed 3000/279ms, rc 0) then --perf-verify same dir
(reopen 89 ms, rc 0); :desktopApp:createDistributable + image --self-test
rc=0; --keys-smoke KEYS ALL-OK; :core:data-jvm:smoke M1a PASS;
assembleDebug SUCCESSFUL.
This commit is contained in:
Incido Developer committed 2026-10-06 23:18:27 +13:00
1 parent 6f16e87ec0
commit 9f6124a501
3 files changed
+104 -8

No files matched your search

@@ -130,6 +130,12 @@ fun main(args: Array<String>) {
// --onboarding-verify on the SAME dir asserts the flag gates it off.
val onboardingSmoke = "--onboarding-smoke" in args
val onboardingVerify = "--onboarding-verify" in args
// M5.5 perf legs (Phase 1 recommendation §8 "perf on a multi-thousand-
// note library"): --perf-smoke seeds + times on a FRESH dir,
// --perf-verify times the reopen of the SAME dir. UI stays composed
// throughout — the recomposition pressure is part of the measurement.
val perfSmoke = "--perf-smoke" in args
val perfVerify = "--perf-verify" in args
// Recovery-envelope file legs: --key-export writes the INCKEY1 envelope
// the phone's Settings screen writes; --key-import reads one (e.g. a
// REAL phone export) with the passphrase and installs the key — the
@@ -239,6 +245,8 @@ fun main(args: Array<String>) {
showFirstRun = !onboarded && !otherScriptedLeg,
onboardingSmoke = onboardingSmoke,
onboardingVerify = onboardingVerify,
perfSmoke = perfSmoke,
perfVerify = perfVerify,
backupImport = backupImport,
backupExport = backupExport,
backupExportEnc = backupExportEnc,
@@ -272,6 +280,8 @@ private fun NotesWindow(
showFirstRun: Boolean,
onboardingSmoke: Boolean,
onboardingVerify: Boolean,
perfSmoke: Boolean,
perfVerify: Boolean,
backupImport: String?,
backupExport: String?,
backupExportEnc: String?,
@@ -323,6 +333,53 @@ private fun NotesWindow(
}
}
if (perfSmoke) {
LaunchedEffect(Unit) {
delay(1000) // past first frame, per the §3 collectAsState trap
withContext(Dispatchers.IO) {
val n = 3000
val t0 = System.currentTimeMillis()
repeat(n) { i ->
val now = System.currentTimeMillis()
repository.saveNoteWithHashtags(
note = Note(
id = 0L,
content = "Perf note $i\nbody line",
createdAt = now,
updatedAt = now,
),
hashtagsToAdd = emptySet(),
hashtagsToRemove = emptySet(),
)
}
val seedMs = System.currentTimeMillis() - t0
println("PERF seed notes=$n total=${seedMs}ms per-note=${seedMs / n}ms (UI streaming throughout)")
val t1 = System.currentTimeMillis()
val all = repository.observeAll().first()
println("PERF fresh observeAll notes=${all.size} in ${System.currentTimeMillis() - t1}ms")
all.firstOrNull()?.let { target ->
val t2 = System.currentTimeMillis()
repository.setFavorite(target.id, true)
println("PERF favorite toggle write ${System.currentTimeMillis() - t2}ms")
}
println("PERF seed leg ALL-DONE (library left at ${all.size} notes for --perf-verify)")
}
}
}
if (perfVerify) {
LaunchedEffect(Unit) {
withContext(Dispatchers.IO) {
val t0 = System.currentTimeMillis()
val delivered = repository.observeAll().first { it.isNotEmpty() }
println(
"PERF reopen first non-empty emission notes=${delivered.size} " +
"in ${System.currentTimeMillis() - t0}ms",
)
println("PERF verify leg ALL-DONE")
}
}
}
// M3: theme_mode is a real shared setting here — resolveDark picks the
// scheme. M4.5b: the app's OWN IncidoTheme wraps the shell — the
// shared screens get the exact color scheme + typography the phone