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 16 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 introduces a significant refactor that restructures checkpoint operations, adds a new process execution abstraction, and creates new query paths - changes that go beyond simple optimization and warrant human review. An unresolved comment also raises architectural concerns about the approach. You can customize Macroscope's approvability policy. Learn more. |
| }; | ||
| } | ||
|
|
||
| export async function runProcess( |
There was a problem hiding this comment.
can we get rid of this functoin and use the runCapturedProcess in all consumers? or atleast remove the async wrapper and make it effectful e2e?
There was a problem hiding this comment.
yeah sorry got busy was in the middle of doing that so that we use the effect e2e process instead of the one i came up with, ill get it done now and remove the async wrappers too.
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
Speed up VCS diff loading by computing diffs from canonical turn 0 checkpoints
CheckpointStoreto delegate all checkpoint operations (capture, restore, diff, delete) to the active VCS driver via a newcheckpointsinterface, removing hardcoded git invocations from the store layer.GitVcsDriverusing git plumbing commands, includingdiffCheckpointswith a configurable max output byte limit (CHECKPOINT_DIFF_MAX_OUTPUT_BYTES).getFullThreadDiffinCheckpointDiffQuerynow uses a dedicated full-thread context lookup (getFullThreadDiffContext) that diffs from turn 0 to the requested turn rather than chaining per-turn diffs, which is the source of the claimed speedup.runCapturedProcess/runCapturedProcessPromiseas a new process execution layer with size-limited stdout/stderr, staged timeout termination (SIGTERM then SIGKILL), and Windows process-tree kill viataskkill;runProcessis reimplemented on top of it.diffCheckpointsnow enforces a hard output byte cap; diffs exceeding it are truncated or error depending on configuration, which is a behavioral change for large diffs.Macroscope summarized 2fb898b.