Repository navigation
perf: Hot reload's source snapshot capture rewrites only the sources that changed since the last compile - #3277
Conversation
The incremental capture that follows needs the same counting of unreadable and PDB-checked sources and the same log and warning, so the tally becomes a private nested class both paths can use. The copier becomes partial for the incremental path's file. Behavior is unchanged.
…hanged Every compile rewrote every source of each recompiled assembly into a new directory, although a body edit changes one file. The capture now moves the previous build's directory, named by the stamp, to the new MVID's temporary name, keeps the copies whose unmarked manifest line still matches the source's length and write time, rewrites the rest, and deletes the copies of sources no longer listed. When the previous directory cannot be moved, it copies every source as before.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk | ⚪ Minimal · up to
|
Summary
User Impact
filesReused.Changes
partial, and the per-assembly tally of unreadable and PDB-checked sources moves into a private nested class, so both capture paths share it.HotReloadSourceSnapshotterreads the stamp of the previous build. If that build's directory still exists and has a manifest, the newHotReloadSourceSnapshotCopier.CaptureIncrementallybuilds on it. Otherwise the existing full copy runs.CaptureIncrementally:Deletes a leftover temporary directory, reads the previous manifest, and moves the previous directory to the new temporary name. If that move fails, it falls back to the full copy and leaves the previous directory where it was.
For each listed source, keeps the previous copy when all of these hold:
Any other source has its previous copy deleted and is copied, with the same checks as the full copy.
Deletes the copies of sources the assembly no longer lists, writes the manifest, and publishes with one move. The stamp is written only after that, as before.
docs/vibe-logs.md(filesReused, and where the new steps' time is counted) anddocs/hot-reload.md(how the snapshot directory is built).Input space (summary)
Exits × invariants
On every exit:
Constraint for a later change
Between the two moves, an assembly's snapshot is not published anywhere. Today the capture finishes synchronously before any reader runs: before the command listener opens, or at the start of a hot reload run. So no reader can observe the gap. A later change that moves the capture to a pool thread must do one of two things:
Verification
uloop compileon the integration branch with this PR: 0 errors. The only warnings are pre-existing ones in test fixtures.HotReloadIncrementalSnapshotCaptureTests: 18 tests, 22 with test cases, all passed. The two permission tests that root would pass anyway are ignored when the effective uid is 0, and the three permission tests skip Windows.HotReloadSnapshotAssemblyEnumerationTests22,HotReloadSourceSnapshotTests19,HotReloadSourceSnapshotterTests9,HotReloadSnapshotEditedDuringCompileTests4.HotReloadChangedSiblingSourceDetectorTests31,HotReloadChangedFileAggregatorTests5,HotReloadChangedSourceDetectorTests7,HotReloadDefaultFilesTests16.SourceMarkedEditedAfterCompile_CopiesTheCurrentBytesSourceWhoseLengthOrWriteTimeChanged_CopiesTheCurrentBytes(both cases),UnreadableSourceThatChanged_...,CaptureAssemblies_ReportsReusedAndCopiedFilesSourceRemovedFromTheAssembly_DeletesItsCopySourceMissingNow_LeavesNoCopyAndNoLine,UnreadableSourceThatChanged_...WhenThePreviousDirectoryCannotBeMoved_FallsBackToAFullCopy(macOS)uloop compile, then reverted and compiled again.assembliesCaptured1,filesCopied1,filesReused5,filesChecked0.scripts/check-file-length.shandscripts/check-code-complexity.shreport no findings.