Repository navigation
perf: parallelize git calls in log for 50-70% speedup - #30
Merged
Merged
Conversation
Shell script that creates temp repos at small/medium/large scales, times gw log, and counts git subprocess calls with a wrapper shim. Baseline: ~20ms per git subprocess, ~3-4 calls per branch. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rewrites the log command to minimize git subprocess spawns: - Uses for-each-ref SHAs to eliminate per-branch rev-parse calls - Batches all merge-base calls into a single bash subprocess - Batches all git log calls into a single bash subprocess - Batches rev-list --count for behind detection Benchmarks (25 branches): 1673ms -> 1171ms (30% faster) Git subprocess calls: 79 -> 53 (from Rust: 5 fixed + batched) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rewrites the batch data-gathering to use one bash subprocess that runs all merge-bases, logs, and behind-counts in parallel using background jobs and temp files. Output is collected sequentially after all jobs complete to avoid interleaving. From Rust: 4 subprocesses total (2 rev-parse, 1 for-each-ref, 1 bash). Benchmarks vs original: Small (3 branches): 278ms -> 142ms (49% faster) Medium (9 branches): 639ms -> 228ms (64% faster) Large (25 branches): 1673ms -> 495ms (70% faster) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Rewrites
gw logto minimize and parallelize git subprocess calls:for-each-refcall gets all branch SHAs and remote tracking info (eliminates per-branchrev-parse)rev-parse --show-toplevel,rev-parse --abbrev-ref HEAD,for-each-ref, onebashscript)Also adds a benchmark harness (
bench/log_bench.sh) that creates temp repos at various scales and measures timing + git call counts.Benchmarks
Test plan
🤖 Generated with Claude Code