Repository navigation
perf(gui): target refreshes after push, pull, and fetch - #50
HiFiveJazz wants to merge 9 commits into
Conversation
ce79f77 to
9fdf274
Compare
|
Confidence: 3.5/5The push/pull/fetch/auto-fetch targeting is correct in everything I ran and cuts git commands a lot. Two things hold it back: it silently stops the periodic refresh from picking up external changes (reproduced), and it now conflicts with main. Checks run
SummaryThanks Jazz, the targeted refresh holds up. Push drops from 26 to 6 git commands, fetch from 26 to 8, and the background auto-fetch idle cost falls from 295 commands per 20 s to 19, all still correct against
Mapflowchart LR
ctl[controller/*.rs: pass RemoteOpKind] --> start[Gui::start_remote_op]
start --> recv[receive_remote_op_results]
recv -->|Push| push[refresh_after_push, sync]
recv -->|Pull| pull[start_background_pull_refresh]
recv -->|Fetch / autofetch| fetch[start_background_fetch_refresh]
recv -->|checkout| co[start_background_checkout_refresh]
tick[main loop periodic] --> per[start_background_periodic_refresh]
pull --> gm[git/mod.rs load_model_after_*_streaming]
fetch --> gm
co --> gm
per --> gm
gm --> tag[git/tag.rs load_tags_after_remote_update]
gm --> cm[git/commit.rs apply_checkout_head_state]
Start at Regressions
MigrationsNone. No config, keybinding or format changes. Before merging
|
Summary
Avoid full repo refreshes after successful push, pull, and fetch operations when only a subset of the model can have changed.
Instead:
Fetch-and-checkout and unrelated remote operations keep the existing full refresh behavior where HEAD/worktree state may have changed.
Why
Remote operations often set
needs_refresh = true, which schedules a full repo refresh, which is expensive especially on big projects that use git like the Linux Kernel, leaving a lot performance to be desired.The goal here is to keep the existing Git CLI architecture, but make refreshes operation-specific instead of blindly reloading the whole model.
Benchmarks
All Linux kernel measurements below were taken against the same checkout/configuration using
strace.Push
Using a local repo as the push target so the benchmark mostly isolates lazygitrs refresh work:
This optimizes the refresh work performed after
git pushcompletes.Pull
The targeted pull refresh reduced the post-pull command set from:
The improvement comes from avoiding unrelated model reloads afterward.
The follow-up tag optimization also removes the remote tag discovery work that still remained in the targeted pull path:
git remotegit ls-remote --tags <remote>per configured remoteWith three configured remotes, that removed another 4 Git commands from the traced operation, though there are more ways to optimize pull still that I'm looking into.
Fetch
The targeted fetch path refreshes only branches, commits, remotes, and tags.
The raw
git fetchitself is unchanged; this measures the refresh workperformed after it completes.
Background Auto-fetch
When periodic auto-fetch reports that refs changed, it now reuses the same targeted fetch refresh instead of scheduling a full model refresh.
This reduces recurring background work while lazygitrs is left open.
Correctness
cargo fmt --checkpassesgit diff --checkpasses