Skip to content

perf: parallelize gw log git calls (1.8x faster) - #37

Merged
jondeibel merged 2 commits into
mainfrom
optimize-log
Mar 9, 2026
Merged

jondeibel merged 2 commits into
mainfrom
optimize-log

Conversation

@jondeibel

Copy link
Copy Markdown
Owner

Summary

  • Replace bash batch script with direct spawned processes in gw log. The old approach launched a single bash subprocess that used mktemp -d, temp files, wait, cat, and rm -rf. Now each merge-base, log, and rev-list spawns directly as a child process via Git::spawn/collect.
  • Overlap current_branch with for-each-ref by spawning both at the start of run() instead of running them sequentially.
  • Add Git::discover_with_branch() to combine rev-parse --show-toplevel and --abbrev-ref HEAD into one subprocess (saves ~20ms, available for future use).

Performance

Tested on Webflow repo (355k commits, 2.6GB .git):

Before After
gw log 160ms 90ms

No regression to gw status (still ~82ms on criterion bench).

Test plan

  • All 156 existing tests pass
  • gw log output identical on webflow repo
  • cargo bench --bench status_bench shows no regression

jondeibel and others added 2 commits March 9, 2026 10:27
Git::discover_with_branch() runs rev-parse --show-toplevel and
--abbrev-ref HEAD in a single subprocess, saving ~20ms of process
spawn overhead on every invocation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… log

Overlap current_branch with for-each-ref using spawn/collect, and
replace the single bash subprocess (which used mktemp, temp files,
wait, cat, rm) with direct spawned git processes.

Webflow repo (355k commits): 160ms -> 90ms (1.8x faster)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jondeibel
jondeibel merged commit 7b57991 into main Mar 9, 2026
1 check 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.

1 participant