Skip to content

perf(config): avoid duplicate git lookups in vp config hook setup - #3501

Merged
fengmk2 merged 4 commits into
voidzero-dev:mainfrom
jong-kyung:perf/config-hooks-git-calls
Nov 20, 2026
Merged

fengmk2 merged 4 commits into
voidzero-dev:mainfrom
jong-kyung:perf/config-hooks-git-calls

Conversation

@jong-kyung

Copy link
Copy Markdown
Collaborator

Problem

vp config usually runs from a prepare script, so it runs on every install. When the hooks were already installed and nothing changed, it still started 15 git processes, and 5 of them repeated an earlier lookup. config/bin.ts resolved the hooks location and checked the disable preference, and then install() did both again.

Fix

  • install() accepts an already-resolved location. vp config passes the location it resolved and skips the second preference check, because it has already checked the preference. enable() had the same double lookup and now passes its location too.
  • getGitWorktree() reads the worktree root and the prefix with one git rev-parse --show-toplevel --show-prefix call instead of two.
  • The --get-all checks before each config write are unchanged, because they let concurrent runs in linked worktrees skip writes that would contend for config.lock.
  • A steady-state run now starts 9 git processes instead of 15. What gets written and reported is unchanged.

Benchmark

Measured on macOS in a Git repository with a package.json and the hooks already installed, so every measured run is the no-change case. --no-agent skips the agent instructions step, which this change does not touch, so the timing covers only the hooks setup. Hyperfine compared the merge base 5b0f891f9 with this PR over 20 runs each, after 3 warmup runs.

Command Merge base This PR Change
vp config --no-agent 259.6 ms ± 21.8 ms 200.1 ms ± 21.5 ms 22.9% faster
Hyperfine output

hyperfine result for vp config --no-agent

file-cbcff9de24d4796d90398a2500bf1247

@jong-kyung jong-kyung self-assigned this Nov 20, 2026
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T02:34:06.845627Z bbb8f8b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 82fd0eb535

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/cli/src/config/hooks.ts Resolved
Comment thread packages/cli/src/config/bin.ts Resolved
@jong-kyung

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 32706fb762

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jong-kyung
jong-kyung marked this pull request as ready for review November 20, 2026 02:29
@jong-kyung
jong-kyung requested a review from fengmk2 November 20, 2026 02:33
@fengmk2
fengmk2 merged commit 8732cb1 into voidzero-dev:main Nov 20, 2026
50 checks passed
@jong-kyung
jong-kyung deleted the perf/config-hooks-git-calls branch November 20, 2026 03:51
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