Skip to content

Exit update early when nothing changed and read HEAD in-process - #112

Merged
cdobbyn merged 3 commits into
mainfrom
perf-update-q7k2
Nov 12, 2026
Merged

cdobbyn merged 3 commits into
mainfrom
perf-update-q7k2

Conversation

@cdobbyn

@cdobbyn cdobbyn commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

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.

@cdobbyn

cdobbyn commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

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]

corpus scenario main branch delta p
curl no-change 0.096 [0.002] 0.021 [0.000] -78.1% 0.0003
curl edit 0.098 [0.001] 0.096 [0.000] -2.0% 0.0055
redis no-change 0.105 [0.001] 0.019 [0.001] -81.9% 0.0003
redis edit 0.114 [0.001] 0.116 [0.004] +1.8% 0.16
graphify no-change 0.092 [0.001] 0.019 [0.000] -79.3% 0.0003
graphify edit 0.093 [0.002] 0.091 [0.002] -2.2% 0.07
opencv cold 0.743 [0.027] 0.731 [0.059] -1.6% 0.66
opencv no-change 0.437 [0.008] 0.048 [0.002] -89.0% 0.0004
opencv edit 0.438 [0.013] 0.437 [0.020] -0.2% 0.93
k8s cold 2.639 [0.060] 2.635 [0.040] -0.2% 0.79
k8s no-change 2.024 [0.121] 0.153 [0.006] -92.4% 0.0004
k8s edit 2.023 [0.042] 2.063 [0.047] +2.0% 0.052
vscode no-change 1.941 [0.048] 0.152 [0.003] -92.2% 0.0004
vscode edit 1.980 [0.055] 1.949 [0.047] -1.6% 0.51
typescript no-change 1.416 [0.020] 0.133 [0.004] -90.6% 0.0004
typescript edit 1.414 [0.040] 1.427 [0.025] +0.9% 0.25

Peak RSS, ru_maxrss (MB), median [IQR]

corpus scenario main branch delta p
curl no-change 70.7 [2.3] 22.9 [0.1] -67.6% 0.0004
curl edit 72.8 [1.7] 73.6 [1.0] +1.1% 0.25
redis no-change 84.7 [1.6] 22.6 [0.2] -73.3% 0.0004
redis edit 92.5 [5.7] 89.8 [5.1] -2.9% 0.25
graphify no-change 74.5 [1.3] 22.5 [0.1] -69.8% 0.0004
graphify edit 78.7 [4.1] 76.6 [2.7] -2.7% 0.57
opencv cold 271.9 [13.3] 274.1 [11.2] +0.8% 0.29
opencv no-change 244.2 [5.3] 26.8 [0.5] -89.0% 0.0004
opencv edit 255.1 [4.3] 255.8 [5.8] +0.3% 0.83
k8s cold 713.8 [13.7] 713.1 [9.7] -0.1% 0.76
k8s no-change 749.2 [37.9] 40.5 [1.1] -94.6% 0.0004
k8s edit 769.9 [14.3] 770.2 [11.0] +0.0% 0.60
vscode no-change 895.3 [16.0] 39.7 [0.4] -95.6% 0.0004
vscode edit 903.7 [4.6] 893.4 [32.1] -1.1% 0.86
typescript no-change 511.9 [10.3] 57.1 [1.0] -88.8% 0.0004
typescript edit 510.6 [18.5] 508.7 [18.6] -0.4% 0.86

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, affected with no file arguments, serve freshness merge-base/diff, and the rev-parse --show-toplevel in rootUsable when GRAPHIFY_OUT is outside the tree.

chris added 2 commits October 20, 2026 22:34
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.
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.
@cdobbyn
cdobbyn merged commit 0ce72f3 into main Nov 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants