Repository navigation
Exit update early when nothing changed and read HEAD in-process - #112
Conversation
|
Benchmark: main vs this branch, n=9 per binary, ABAB, first binary swapped per corpus, run1.py under heavy.sh. Mann-Whitney p (normal approximation). graph.json and GRAPH_REPORT.md were byte-identical (cmp) on every corpus. Wall (s), median [IQR]
Peak RSS, ru_maxrss (MB), median [IQR]
graph.json bytes (same for both): curl 17245854, redis 21799761, graphify 18824216, opencv 87499073, k8s 465443470, vscode 466626548, typescript 217132102. A separate rerun (own script, branch first, exact Mann-Whitney) confirmed it: edit update on redis +0.9% (p=0.58), k8s +0.0% (p=0.95), typescript -0.5% (p=0.75); no-change on k8s -92.0% and vscode -91.6% wall, -94.5% and -95.4% RSS (p=0.008). The in-process HEAD read saves about 6 ms per run in a git repo (no-change update on a 686-file repo: 18 ms against 24 ms with git forced). The first no-change update right after an edit still takes the full path once, because the stat sidecar's 2 s mtime granularity rule holds the edited file as unsure, same as main. Not in this PR (filed as graphify-go-4ln.11): git exec in hook install/uninstall/status, |
A no-change update now checks the stat sidecar and a fingerprint of every other output input and skips cache load, resolve, cluster and writes. gitHead reads .git directly and falls back to git rev-parse when unsure.
4f3f925 to
2fb81cf
Compare
git discovery fails at a filesystem boundary, so the in-process answer there is empty, not a fallback. CI's /tmp is its own mount.
graphify update now skips loading the cache, resolving, clustering and writing when every file is stat-fresh and a fingerprint of the other output inputs (commit, flags, walk, manifests, binary, output files) matches the last write; gitHead reads .git directly instead of running git rev-parse, falling back to git for any layout it cannot be sure of. This covers graphify-go-4ln.4 and the hot-path part of graphify-go-4ln.8. I ran go test ./..., byte-for-byte cmp of graph.json and GRAPH_REPORT.md against main on curl, redis, graphify, opencv, k8s, vscode, typescript and a git archive of graphify-go (cold, edit, no-change, plus commit/pack-refs/detached/worktree cases in a git repo), and an n=9 ABAB benchmark; tables follow in a comment.