Repository navigation
perf: Skip the hot reload source snapshot capture when the hot-reload and pause-point tools are both disabled - #3276
Conversation
…ds it A pause point read the snapshot without asking the gate, so once the startup captures can be skipped it could read a snapshot that was never taken in this domain. The port now asks the gate first; a capture that throws reaches the pause-point command, as it does for a hot reload run, and the gate stays unmarked so the next read tries again.
…ds them The capture after a domain reload blocks the main thread on every compile even when the user disabled both tools that read the snapshot. The two startup captures now ask the tool settings and log a skip when hot-reload and pause-point are both disabled, leaving the gate unmarked so the first run or pause point after a tool is enabled captures. The warm-up is skipped when hot-reload is disabled. The compile-start record and the artifact sweep still run, because a later capture needs the compile start to tell compiled sources from edits made during the compile.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk | ⚪ Minimal · up to
|
…' into perf/hot-reload-snapshot-skip-when-tools-disabled # Conflicts: # docs/vibe-logs.md
…h its own trigger The port tests hand the capture in directly, so replacing the composition root's capture with a no-op, or passing another trigger, passed every test.
…' into perf/hot-reload-snapshot-skip-when-tools-disabled # Conflicts: # docs/hot-reload.md
Summary
User Impact
Changes
pause_point.hot_reload_source_snapshot_skipped(trigger,reason=tools_disabled) and leave the gate unmarked. The warm-up is not started when the hot-reload tool is disabled; it logshot_reload_warm_up_skippedwithreason=tool_disabled. The settings check is handed in from the composition root as a function, because the tool settings are not visible to the tool assemblies.docs/vibe-logs.mdanddocs/hot-reload.md.pause_pointtrigger. The port tests hand the capture in directly, so they could not catch a wrong wiring.Why the compile-start record and the sweep still run when the tools are disabled
The capture decides which sources it must check against the PDB by comparing their write time with the moment the last compile started. If the compile start were not recorded while the tools are disabled, a capture taken after a tool is enabled would fall back to the dll's write time. A source edited during the compile would then be recorded as compiled source. The sweep only removes artifacts of earlier domains, and skipping it would leave them behind for the next run. So only the two startup captures and the warm-up look at the tool settings.
Input space covered
..._WhenNeitherReaderToolIsEnabled_SkipsAndLeavesTheCaptureForAReader,..._AsksBothReaderToolsBySettingsName..._WhenOnlyOneReaderToolIsEnabled_Captures(2 cases), existing tests..._AtTheFirstUpdateTick_WhenNeitherIsEnabled_SkipsWithThatTriggerHotReloadSourceSnapshotCaptureTestsapply)GetVerifiedSnapshotSource_EnsuresTheSnapshotIsCapturedGetVerifiedSnapshotSource_WhenTheCaptureThrows_PassesTheExceptionOnGetVerifiedSnapshotSource_WithAnEmptyPath_DoesNotEnsureTheCaptureStartWarmUpUnlessHotReloadIsDisabled_WhenHotReloadIsDisabled_...StartWarmUpUnlessHotReloadIsDisabled_WhenHotReloadIsEnabled_StartsOnceImport worker processes return before the check, as before. A missing or blank settings file, or one with
disabledTools: null, reads as every tool enabled, so it adds no branch. A settings file that is not valid JSON makesIsToolEnabledthrow, as it already does for every tool command; the two startup captures and the warm-up start then throw too and Unity logs each, but nothing else in the startup is skipped, because the domain-load capture runs last and each first-update-tick callback unsubscribes itself before doing its work.Verification
Local, Unity 2022.3 Editor via the dev
uloopbinary.uloop compile: ErrorCount 0.uloop compile-check --allreports the same 7 warnings, all from existing test fixtures, with this branch's files and with the base branch's versions of them.scripts/check-file-length.shandscripts/check-code-complexity.sh: no findings.HotReloadEditorStartupTests: 9 (7 added).HotReloadSourceSnapshotCaptureTests: 6.HotReloadDomainTests: 49 (3 added).HotReloadCompositionRootTests: 7 (1 added).if (false): only the two "neither tool enabled" skip tests failed (domain load and first update tick).GetVerifiedSnapshotSource_EnsuresTheSnapshotIsCapturedand..._WhenTheCaptureThrows_PassesTheExceptionOnfailed.applytrigger:Install_PausePointSide_CapturesThroughTheInstalledGateWithThePausePointTriggerfailed each time.--force-recompiledoes not return a definitive compile result, so each reload was followed up with a plainuloop compile.hot-reloadandpause-pointboth indisabledTools, the reload loggedhot_reload_source_snapshot_skippedtwice (domain_load,first_update_tick, bothtools_disabled) andhot_reload_warm_up_skippedonce (tool_disabled). It logged nohot_reload_source_snapshot_captured.hot-reloaddisabled, the reload loggedhot_reload_source_snapshot_capturedonce (domain_load) andhot_reload_warm_up_skippedonce (tool_disabled).hot_reload_source_snapshot_captured(domain_load) and a completed warm-up again.pause_point) cannot be toggled from the CLI. The port tests cover it.