You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SWF(perf): batch git reads in issue listing - #645
list_issues spawned one git cat-file --batch process per issue. That's a fork and exec for every row, so the list endpoint got slower with every issue a repo collected. Now it spawns one cat-file --batch, writes every blob id to it, and reads the replies back in ref order. Ref enumeration is still a single git for-each-ref. Only crates/twigpine-node/src/git/issues.rs changes.
Behavior doesn't change. A missing object is still skipped, and so is a ref deleted between enumeration and the read. A blob that isn't valid issue JSON is still filtered out.
Benchmark
Issue refs
Before (ms)
After (ms)
Speedup
0
1.058
1.088
0.97x
10
18.712
4.924
3.80x
100
163.871
9.730
16.84x
500
637.970
30.289
21.06x
1,000
1,279.264
57.968
22.07x
2,500
5,047.318
194.439
25.96x
Method: median of 9 alternating release-mode runs, calling the old and new list_issues in-process against the same warm bare repos. Fixture setup and JSON serialization aren't timed. Ubuntu x86-64 Intel Xeon VM, pinned to one logical CPU, Git 2.56.0. The 0-ref row is noise.
Separate fixtures with a non-blob ref, a corrupt blob, and a ref deleted mid-listing also matched. New unit tests pin exact output for multiline, large, and malformed blobs.
test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 8 filtered out
Try it
cargo test -p twigpine-node --lib git::issues
Not tested
Workspace clippy and cargo test --workspace don't compile on current main until #643 lands, so CI here will be red until then. An untouched main checkout fails the same way:
error: could not compile `twigpine-node` (lib) due to 5 previous errors
So the full node suite and the live HTTP endpoint haven't run against this change.
Summary by CodeRabbit
Bug Fixes
Improved reliability when reading individual issues and issue lists, including when referenced issues disappear during retrieval.
Issue lists now preserve ordering and handle large issue contents correctly.
Invalid or incomplete issue data is handled more consistently.
No actionable comments were generated in the recent review.
Walkthrough
Issue blob reads now consume and validate records from cat-file --batch. list_issues sends validated refs through one batch process, preserves their order, skips refs that disappeared, and rejects inconsistent or extra output. Tests cover large bodies, invalid JSON, and missing records.
Changes: Issue Batch Reading
Layer / File(s)
Summary
Parse batch records crates/twigpine-node/src/git/issues.rs
A shared parser consumes one batch record, checks its blob type, body length, and separator, and recognizes missing-ref records. Both single-issue readers use it and recheck refs when a record is missing.
Read issue lists in batches crates/twigpine-node/src/git/issues.rs
list_issues validates refs and reads them through one cat-file --batch process. It preserves listing order, skips refs that disappeared, errors when a missing ref still resolves, and rejects extra output. Tests cover missing records, ordering, and large issue bodies.
sequenceDiagram
participant list_issues
participant Git
participant cat_file as cat-file --batch
participant read_batch_record
list_issues->>Git: Validate and enumerate issue refs
list_issues->>cat_file: Submit refs
cat_file-->>list_issues: Return batch output
loop For each listed ref
list_issues->>read_batch_record: Parse next record
read_batch_record-->>list_issues: Return body or missing record
opt Record is missing
list_issues->>Git: Recheck ref
Git-->>list_issues: Return ref resolution
end
end
Loading
Possibly related PRs
Twigpine/node#437: It defines overlapping missing-ref and unreadable-object behavior for read_issue_blob and list_issues.
Suggested labels:crate:node, kind:perf
Suggested reviewers:kevincodex1, jatmn
Merge Risk: Minimal · up to 5455c
This change makes issue listing much faster by reading all issues through one Git process instead of one process per issue. Output and error handling for missing or malformed issues are meant to stay the same. No concrete defects were found in the reviewed code, and the targeted tests reportedly pass, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "SWF(perf): batch git reads in issue listing" names the main change: list_issues now submits all refs to one git cat-file --batch process instead of one process per issue. It is specific, co…
Description check
The description covers the required sections. It has a summary (the performance problem and fix), motivation context (the per-issue fork cost), what changed (only issues.rs, one batch process), and a …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "SWF(perf): batch git reads in issue listing" names the main change: list_issues now submits all refs to one git cat-file --batch process instead of one process per issue. It is specific, concise, and matches the summary and objectives. The title is in Conventional Commit-style form with a scope, which is a minor style point and does not affect the verdict.
Full details: Description check
Explanation
The description covers the required sections. It has a summary (the performance problem and fix), motivation context (the per-issue fork cost), what changed (only issues.rs, one batch process), and a verification section with a runnable test command and a benchmark. It also states behavior is unchanged and explains what was not tested. Gaps against the template: no 'Closes #' issue link is given, the 'Kind of change' checkboxes are not ticked (the change is a performance change, so 'Refactor (no behavior change)' or similar is unmarked), the crate name is noted only by path, the 'Before you request review' checklist is not filled in, and the 'Protocol & signing impact' block is absent (it may be deleted if it does not apply). These are non-critical, so the description is mostly complete.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: f42604ed-0379-4bb9-b445-669511f27895
Commits
Reviewing files that changed from the base of the PR and between 6168c55 and 5455c8a.
Files selected for processing: 1
crates/twigpine-node/src/git/issues.rs
Limit details: You’ve used the included review currently available.
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
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.
Listing 1,000 issues took 1.28 s. Now it's 58 ms.
list_issuesspawned onegit cat-file --batchprocess per issue. That's a fork and exec for every row, so the list endpoint got slower with every issue a repo collected. Now it spawns onecat-file --batch, writes every blob id to it, and reads the replies back in ref order. Ref enumeration is still a singlegit for-each-ref. Onlycrates/twigpine-node/src/git/issues.rschanges.Behavior doesn't change. A missing object is still skipped, and so is a ref deleted between enumeration and the read. A blob that isn't valid issue JSON is still filtered out.
Benchmark
Method: median of 9 alternating release-mode runs, calling the old and new
list_issuesin-process against the same warm bare repos. Fixture setup and JSON serialization aren't timed. Ubuntu x86-64 Intel Xeon VM, pinned to one logical CPU, Git 2.56.0. The 0-ref row is noise.Process count at 1,000 refs, from
strace:Same output
Raw listings and the HTTP JSON were byte-identical before and after at every count above. SHA-256 of the 1,000-ref JSON:
Separate fixtures with a non-blob ref, a corrupt blob, and a ref deleted mid-listing also matched. New unit tests pin exact output for multiline, large, and malformed blobs.
Try it
cargo test -p twigpine-node --lib git::issuesNot tested
Workspace clippy and
cargo test --workspacedon't compile on current main until #643 lands, so CI here will be red until then. An untouched main checkout fails the same way:So the full node suite and the live HTTP endpoint haven't run against this change.
Summary by CodeRabbit