Measure and reduce newgit's power draw and compute cost
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- git, linux, macos, rust
- Ambito
- performance, tooling
Direzione di ricerca
Start by reading the command implementations and polling paths named in the issue, especially crates/newgit-core/src/compose.rs, supervisor.rs, lock.rs, fresh_base.rs, manager.rs, and source.rs. Then identify a realistic agent session to benchmark and record wall time, CPU time, subprocess counts, I/O, disk use, and idle cost; the issue also calls for remote CPU measurements. Done means a repeatable benchmark has run, baseline numbers are recorded, and each confirmed hotspot is fixed with before and after numbers or filed separately.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
newgit runs underneath agents that call it constantly, often many instances at once on a laptop. Whatever it costs per command gets multiplied by every agent, every instance, and every turn. Right now we don't know what that cost is. This issue is about measuring it first and then cutting what turns out to be waste.
Why it matters
- Agents call newgit far more often than people call git. A 50 ms overhead that nobody notices by hand becomes real CPU time and battery drain across a fleet of parallel instances.
- Idle cost is worse than per-command cost. Anything that keeps waking up (supervised processes, polling, retries) drains power even when nobody is working.
- On the remote, CPU time costs money. Worker CPU time is billed, and the remote now pauses itself when a week's bill passes its budget (#314). Wasted work there means hitting that pause sooner.
Leads worth checking (unmeasured, not confirmed problems)
Process and I/O cost per command
- How many
gitsubprocesses each command spawns (spawn,checkpoint,undo,status,run,capture,merge). Fork and exec on every call adds up, so it's worth checking whether a single in-process read (gix/git2) would serve the read-only paths. - The compose/split engine (
crates/newgit-core/src/compose.rs): what it costs per commit, and whether that cost grows with the number of bound trackers or with history length. - Workspace materialization: each workspace is a full independent clone. Measure the time, disk I/O, and bytes written per
spawn, and check whether CoW cloning (APFSclonefile, reflinks) is actually being used wherever it could be (store, installs, tracker projection). status: does it rescan the whole workspace every time? Agents run it in loops.
Wakeups and polling
- Fixed-interval sleep loops:
supervisor.rs(20/100/300 ms),lock.rs(10/200 ms),fresh_base.rs(50 ms),manager.rs(200 ms readiness),source.rs. Each is fine on its own. The question is whether any of them run for long, or while idle, and whether an event (pidfd/kqueue, fs notify, a lock wait) could replace the poll. - Does anything newgit starts keep running between commands, and what does it cost while idle?
- Port readiness probes (
TcpStream::connect_timeoutloops).
Remote (remote/)
- CPU ms per request for the hot paths: the Git endpoint (clone/fetch), checkpoint upload, and auth.
- Repeated work that could be cached, such as recomputing pack or ref listings and re-verifying tokens.
Proposed approach
- Measure first, no optimizing yet. Add a small benchmark script under
scripts/that runs a realistic agent session (spawn N instances, edit, checkpoint, undo, status loop, merge, drop) and records:- wall time and CPU time (user and sys) per command
- number of subprocesses spawned per command
- bytes read and written, and disk used per instance
- idle CPU wakeups / energy impact with N instances alive (
powermetrics/top -stats poweron macOS,perf stat/powertopon Linux) - remote: CPU ms per request from Worker analytics
- Write down the baseline (a short
docs/note or a comment here) so later changes can be compared against it. - Fix the biggest items, smallest change first. Each fix should come with a before/after number.
- Consider a CI check for regressions on subprocess count and CPU time for a couple of core commands, along the lines of #183 for web pages.
Done when
- A repeatable benchmark exists and has been run on macOS (and ideally Linux).
- We have baseline numbers for per-command cost, idle cost with N instances, and remote CPU per request.
- Every confirmed hot spot is either fixed with before/after numbers or filed as its own issue.
- Idle instances use roughly no CPU, or the docs explain why they can't.
- Lingua principale
- Rust
- Stelle
- 0
- Fork
- 0
- Merge medio
- 7h 58m
- PR unite (30g)
- 97
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Spheroman/newgit
-
Port allocation order within a resource is unspecifiedForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertadocumentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Spheroman/newgit#59 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
-
`spawn --from-checkpoint` leaves the new instance's workspace on the author's branchForse già presa @MollyMoriJing l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
Spheroman/newgit#289 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Spheroman/newgit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apache/datafusion-iceberg#100 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: cua-driver skill fails Agent Skills frontmatter validationForse già presa @Mearman l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
area/tools bug session-analysis
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
oracle/rust-oracledb#66 ·
-
`PrimitiveArray::validate_decimal_precision` rejects every decimal array with a negative scaleAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno