Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Perf regression: golang/rescan wall +34% (1d523d30, #1403)

オープン
#1,424 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go, rust

調査の方向性

Start in patch/redirect/mod.rs around line 8536 and inspect how the Go rewriter calls GoSumEditor::zip_versions and go_mod_edit::prunes_module_graph for each patched dependency. Read the benchmark repro and run its golang/ comparison to establish a baseline. The issue is done when the repeated scans are addressed and the benchmark shows the regression has been brought back toward the base performance.

索引モデルが issue の本文から書いたものです。

説明

agent:triaged bench perf-regression pm:go priority:p2

[agent] Bench: golang/rescan wall time is +34% and golang/hosted +23% on today's main (17793173), compared with f3c6313a (the previous bench run, 2026-10-09). Request counts are unchanged (64).

Culprit: 1d523d30, #1403 ("Fix Go replace for unselected versions (#391, #392, #509)"). Profiling found it: the hot function, GoSumEditor::zip_versions, was introduced by that commit. It was not bisected with builds.

Same-machine interleaved compare

Base f3c6313a → head 17793173, on a 4 vCPU Intel Xeon @ 2.10GHz cloud sandbox. An A/A run on the same machine was clean (golang/rescan +2.6%, ≈).

scenario round base wall head wall Δ wall [95% CI] Δ CPU requests
golang/hosted 1 (15+10 pairs) 73.0 ms 94.5 ms +27.3% [+18.5, +36.3] +26.8% 64
golang/hosted 2 (20+10 pairs) 70.6 ms 87.2 ms +23.4% [+14.6, +32.1] +27.7% 64
golang/rescan 1 67.1 ms 95.2 ms +45.5% [+33.9, +51.1] +37.2% 64
golang/rescan 2 67.0 ms 88.2 ms +34.3% [+26.4, +39.0] +31.0% 64
Hot spot

Callgrind on the head binary, golang/rescan (1200 modules, 30 patched), inclusive instructions:

68.3%  patch::redirect::rewriter_groups::{{closure}}
30.4%    vendor::go_sum_edit::GoSumEditor::zip_versions
29.0%      <SplitWhitespace as Iterator>::next
15.9%    vendor::go_mod_edit::scan_hosted_replace
10.3%      go_mod_edit::strip_comment

The golang rewriter (patch/redirect/mod.rs, around line 8536) calls go_sum.zip_versions(&fname) once per patched dep, and each call splits every line of go.sum. That makes it O(patched deps × go.sum lines). go_mod_edit::prunes_module_graph(&go_mod) is also evaluated per dep. One pass over go.sum that builds a module → zip versions map, plus a single prunes_module_graph read hoisted out of the loop, should bring it back.

Repro
export CARGO_PROFILE_PERF_INHERITS=release CARGO_PROFILE_PERF_LTO=thin CARGO_PROFILE_PERF_STRIP=none
git worktree add /tmp/base f3c6313a && (cd /tmp/base && CARGO_TARGET_DIR=/tmp/tb cargo build --locked --profile perf -p socket-patch-cli)
CARGO_TARGET_DIR=/tmp/th cargo build --locked --profile perf -p socket-patch-cli -p socket-patch-bench
/tmp/th/perf/socket-patch-bench compare --base /tmp/tb/perf/socket-patch --head /tmp/th/perf/socket-patch -f '^golang/' --runs 20

Runner: nproc 4, Intel(R) Xeon(R) Processor @ 2.10GHz.


Generated by Claude Code

主要言語
Rust
スター
8
フォーク
1
平均マージ
18時間 19分
マージ済み PR(30日)
504

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SocketDev/socket-patch のほかの issue

SocketDev/socket-patch の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。