Make fewer git calls per operation
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- git, rust
調査の方向性
Start with the helpers in crates/newgit-core/src/source.rs and crates/newgit-core/src/compose.rs, then inspect crates/newgit-core/tests/restore_sparse_paths.rs and measure Git process counts with GIT_TRACE2_EVENT. The issue lists batching and disabling auto-maintenance as options, but choosing an approach requires understanding the repo’s operations; done means measuring call counts before and after and restoring the macOS suite to pull request CI.
索引モデルが issue の本文から書いたものです。
説明
newgit starts a new git process for nearly every question it asks the repo. On Linux that costs little. On macOS a process start is expensive, and on GitHub's macOS runners it's the whole cost of CI: the suite there is CPU-bound, at ~30ms per git spawn. That's why macOS left PR CI in #321. A developer's Mac pays the same cost on every spawn, checkpoint, and undo.
How much
crates/newgit-core/tests/restore_sparse_paths.rs starts 816 git processes for 4 tests (counted with GIT_TRACE2_EVENT):
| subcommand | count |
|---|---|
| rev-parse | 116 |
| rev-list | 97 |
| maintenance (auto, after fetch/commit) | 62 |
| for-each-ref | 57 |
| fetch | 53 |
| update-ref | 51 |
| cat-file | 37 |
| config | 29 |
| diff-tree | 23 |
| unpack-objects | 22 |
These are the read and ref plumbing calls that git can batch.
Where to look
Most calls go through a few helpers: git() in crates/newgit-core/src/source.rs, and git(), git_env(), git_lines() and command() in crates/newgit-core/src/compose.rs. compose.rs already uses cat-file --batch in places, so the pattern exists.
Options, cheapest first
- Turn off auto-maintenance in newgit's own repos. Pass
-c maintenance.auto=false -c gc.auto=0(or set it in the store's config). That removes ~8% of spawns at once. newgit should probably decide when its internal repos get gc'd anyway, rather than have git do it after every fetch. - Batch what git already batches:
rev-parse A B Cin one call instead of three.update-ref --stdinfor groups of ref updates. This is also atomic, which is a correctness win.- One
for-each-refwith a format string instead of repeated lookups. - A long-lived
cat-file --batch/--batch-checkper operation.
- Cache within an operation. Many
rev-parseandfor-each-refcalls probably ask the same question more than once within a single command. - Use a library for reads (gix/libgit2), which avoids spawning anything for read-only queries. This is in tension with "never reimplement git's object model": it isn't reimplementing it, but it does add a second implementation that newgit depends on. Needs a decision before anyone starts.
Done when
The git call count for a typical spawn / checkpoint / undo is measured before and after, and the macOS suite is fast enough to put back on pull requests.
- 主要言語
- Rust
- スター
- 0
- フォーク
- 0
- 平均マージ
- 7時間 27分
- マージ済み PR(30日)
- 140
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Spheroman/newgit のほかの issue
-
Port allocation order within a resource is unspecified対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdocumentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Spheroman/newgit#59 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
Spheroman/newgit の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
bytecodealliance/rustix#1736 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
longbridge/gpui-kit#3871 ·
メンテナーはふだん 1 日以内に返信
-
area:models enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
good first issue help wanted
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
servo/rust-smallvec#864 ·