-
Notifications
You must be signed in to change notification settings - Fork 195
Entire Enable performance optimzations #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
evisdren
wants to merge
9
commits into
main
Choose a base branch
from
enable_performance_optimzations
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+265
−80
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1a10a57
add benchmark for enable
evisdren 79846ca
pass localDev param to InstallGitHook and CheckAndWarnHookManagers
evisdren 2d1eed2
cache GetHooksDir() result per working directory
evisdren 556e24e
use cached paths.RepoRoot() in OpenRepository()
evisdren a66a0cc
comment clean up
evisdren 5927a63
fix bench:compare to aggregate all runs and restore git state on inte…
evisdren 0120816
add test for InstallGitHook localDev command prefix
evisdren ece08c8
simplify bench:compare to use benchstat instead of custom Python
evisdren ded5ec3
use branch names as benchstat column headers
evisdren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| package cli | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "os" | ||
| "testing" | ||
|
|
||
| "github.com/entireio/cli/cmd/entire/cli/agent" | ||
| "github.com/entireio/cli/cmd/entire/cli/benchutil" | ||
| "github.com/entireio/cli/cmd/entire/cli/paths" | ||
| "github.com/entireio/cli/cmd/entire/cli/strategy" | ||
| ) | ||
|
|
||
| // BenchmarkEnableCommand benchmarks the non-interactive enable path | ||
| // (setupAgentHooksNonInteractive) which is the hot path for `entire enable --agent claude-code`. | ||
| // | ||
| // Cannot use t.Parallel() because os.Chdir is process-global state. | ||
| func BenchmarkEnableCommand(b *testing.B) { | ||
| ag, err := agent.Get(agent.AgentNameClaudeCode) | ||
| if err != nil { | ||
| b.Fatalf("get agent: %v", err) | ||
| } | ||
|
|
||
| b.Run("NewRepo_ClaudeCode", func(b *testing.B) { | ||
| for b.Loop() { | ||
| b.StopTimer() | ||
| repo := benchutil.NewBenchRepo(b, benchutil.RepoOpts{}) | ||
| //nolint:usetesting // b.Chdir() restores only once at cleanup; we need a fresh dir each iteration | ||
| if err := os.Chdir(repo.Dir); err != nil { | ||
| b.Fatalf("chdir: %v", err) | ||
| } | ||
| paths.ClearRepoRootCache() | ||
| strategy.ClearHooksDirCache() | ||
| b.StartTimer() | ||
|
|
||
| w := &bytes.Buffer{} | ||
| if err := setupAgentHooksNonInteractive(w, ag, "", true, false, false, false); err != nil { | ||
| b.Fatalf("setupAgentHooksNonInteractive: %v", err) | ||
| } | ||
| } | ||
| }) | ||
|
|
||
| b.Run("ReEnable_ClaudeCode", func(b *testing.B) { | ||
| b.StopTimer() | ||
| repo := benchutil.NewBenchRepo(b, benchutil.RepoOpts{}) | ||
| b.Chdir(repo.Dir) | ||
| paths.ClearRepoRootCache() | ||
| strategy.ClearHooksDirCache() | ||
|
|
||
| // First enable to set up everything | ||
| w := &bytes.Buffer{} | ||
| if err := setupAgentHooksNonInteractive(w, ag, "", true, false, false, false); err != nil { | ||
| b.Fatalf("initial enable: %v", err) | ||
| } | ||
| b.StartTimer() | ||
|
|
||
| for b.Loop() { | ||
| b.StopTimer() | ||
| paths.ClearRepoRootCache() | ||
| strategy.ClearHooksDirCache() | ||
| b.StartTimer() | ||
|
|
||
| w.Reset() | ||
| if err := setupAgentHooksNonInteractive(w, ag, "", true, false, false, false); err != nil { | ||
| b.Fatalf("setupAgentHooksNonInteractive: %v", err) | ||
| } | ||
| } | ||
| }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InstallGitHookbehavior now differs based on the newlocalDevparameter (writinggo run ...vsentireinto hook scripts), but the updated tests only exerciselocalDev=false. Add a test case that installs hooks withlocalDev=trueand asserts the generated hook contents use the expected command prefix, to prevent regressions in local-dev setups.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved