Skip to content

perf(github): fetch clone PR refs over https and split review reads - #49

Merged
seatedro merged 1 commit into
masterfrom
rohit/github-fetch-speedups
Oct 27, 2026
Merged

seatedro merged 1 commit into
masterfrom
rohit/github-fetch-speedups

Conversation

@seatedro

@seatedro seatedro commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Why

Follow-up to #48, aimed at the GitHub calls still waited on after that PR.

  • Opening a PR inside your own clone spent ~3.1 s in git fetch every time. The PR refs were fetched through the clone's remote, which is often SSH. Each SSH connection to GitHub costs about 2 s more than HTTPS (git ls-remote: 2.66–2.87 s over SSH, 0.69–0.75 s over HTTPS).
  • Review data on busy PRs came from one heavy GraphQL query: 1.7–2.4 s for 16 threads on Add unstable -Zllvm-tpde flag to rustc_codegen_llvm rust-lang/rust#164108.
  • The signed-out overview made two REST calls one after the other.

What changed

  • Clone path: with a token, PR refs are fetched from https://github.com/<owner>/<repo>.git with token auth. The token is passed through the environment, the same way the review cache does it. If that fetch fails, Diffy falls back to the clone's remote as before. Only Diffy's own PR refs are written, so remote-tracking branches are untouched.
  • Review data comes from two GraphQL queries run at once: one for metadata, checks, labels and latest reviews, and a paged one for review threads. Withheld fields are handled as before.
  • The signed-out overview fetches /pulls/N and /issues/N/comments at the same time.

Results

Timed by hand against GitHub:

before after
open a seatedro/diffy PR in a clone with an SSH origin (4 PRs × 2 rounds) 3.0–3.6 s 1.4–1.6 s
review data for rust-lang/rust#164108 1.7–2.5 s 1.3–1.8 s

The split review read returns the same data: 16 threads, 30 comments, metadata, 2 reviews and 14 checks.

Testing

  • cargo test --lib: 530 passed.
  • cargo clippy --all-targets: no new warnings.
  • Timings come from a throwaway probe run on fresh local clones; the probe is not included.
  • The fallback to the clone's remote after a failed HTTPS fetch has not been exercised.

- Fetch a pull request's refs into a clone over HTTPS with the GitHub
  token, falling back to the clone's remote. An SSH remote cost about
  two seconds more per fetch.
- Read review metadata and review threads in two GraphQL queries at
  once rather than one heavier query.
- Read a signed-out overview's pull request and comments at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@seatedro
seatedro merged commit 8c7874e into master Oct 27, 2026
@seatedro
seatedro deleted the rohit/github-fetch-speedups branch October 27, 2026 14:11
seatedro added a commit that referenced this pull request Nov 3, 2026
perf(github): fetch clone PR refs over https and split review reads
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