Optimize VCS diff loading to be up to 98% faster#2586
Optimize VCS diff loading to be up to 98% faster#2586justsomelegs wants to merge 30 commits intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR refactors core infrastructure including process execution (converting to Effect-based patterns), checkpoint handling (moving operations into VCS driver layer), and adds new database query paths. The scope and architectural changes warrant human review despite the optimization framing. You can customize Macroscope's approvability policy. Learn more. |
2fb898b to
d73ba82
Compare
This reverts commit 7c97ca3.
ae358ea to
01be4db
Compare
What Changed
CheckpointStore.VcsProcess.runandprocessRunneronto a sharedcapturedProcessprimitive for one-shot collected process execution.^{commit}) for checkpoint diff refsWhy
Opening diffs and switching turns was spending too much time in process execution overhead and checkpoint diff orchestration.
This branch improves that by:
Benchmark Summary
Synthetic workload used for all numbers below:
24changed files690,422patch bytes26,137patch linesBenchmarks were run sequentially to avoid contention between benchmark loops.
Mean Latency
upstream/maincheckpointStore.diffCheckpoints1179.81ms72.84mscheckpointDiffQuery.getTurnDiff1649.32ms52.05msparseTurnDiffFilesFromUnifiedDiff12.42ms11.97msTail Latency (
p99)upstream/maincheckpointStore.diffCheckpoints2262.90ms355.04mscheckpointDiffQuery.getTurnDiff2937.21ms191.04msparseTurnDiffFilesFromUnifiedDiff16.43ms19.63msKey Measurements
Compared directly with
upstream/main:checkpointStore.diffCheckpoints:1179.81ms->72.84msmean (16.20xfaster,93.8%lower)checkpointDiffQuery.getTurnDiff:1649.32ms->52.05msmean (31.69xfaster,96.8%lower)checkpointStore.diffCheckpoints:2262.90ms->355.04msp99checkpointDiffQuery.getTurnDiff:2937.21ms->191.04msp99Before
before.vcs.optimisation.mp4
AFTER
vsc.after.optimisations.mp4
Checklist
Note
Replace legacy
runProcesswith a typedProcessRunnerservice to speed up VCS diff loadingrunProcessand Nodechild_processimplementation inprocessRunner.tswith an Effect-basedProcessRunnerDI service backed by stream-based stdin/stdout/stderr handling.ProcessSpawnError,ProcessTimeoutError,ProcessOutputLimitError, etc.) replacing genericErrorinstances, enabling pattern-matched failure handling.truncateOutputAtMaxBytestoappendTruncationMarkeracrossVcsProcess,GitVcsDriver, andGitVcsDriverCore; fixes a performance issue incollectUint8StreamText.tsby accumulating raw byte chunks and decoding once instead of incrementally.checkpointsAPI toVcsDriverShapeand implementscaptureCheckpoint,hasCheckpointRef,restoreCheckpoint, anddiffCheckpointsinGitVcsDriver;CheckpointStorenow delegates all checkpoint ops to the active VCS driver.getFullThreadDiffinCheckpointDiffQuerynow uses a dedicatedgetFullThreadDiffContextquery (viaProjectionSnapshotQuery) instead of delegating togetTurnDiff, enabling a direct turn-0-to-target diff without preflighthasCheckpointRefchecks.VcsProcess,RepositoryIdentityResolver,ServerEnvironmentLabel, andTerminalManagerlayers now requireProcessRunnerin their environment; callers providing these layers must includeProcessRunnerLive.Macroscope summarized cc97acb.