perf(npm/csharp): a child chain is derived for every node with a parameter list
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- performance, tooling
調査の方向性
src/metrics/npm/csharp.rs と issue に記載された Java のガードを読み、src/observation_tests.rs の the_member_walks_derive_a_chain_per_body_not_per_node と member_walk_siblings::FIXTURES を調べてください。子チェーンを導出する前に C# のノード種別を確認し、その後、ガードを C# または fixture の行に拡張してください。既存のガードにリグレッションを起こさず、C# の body ごとのカウントが期待される動作と一致すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
C#'s Npm::compute derives a child chain for every node that has a parameter_list child, before it knows the node is a type declaration. A class with 65 methods derives 67 chains where the other languages derive 2.
Measured
Counted with child_chains_derived over Ast::metrics with only Npa and Npm selected, on a class body of 65 units. Measured on the local branch refactor/1871-sibling-followups (not pushed) at e0cc1918, whose base is 68b70b08; the C# code is unchanged from main:
| Language | Unit | Chains derived |
|---|---|---|
| Java | int x; and void m() {} |
2 |
| Kotlin | val x = 1 and fun m() {} |
2 |
| C++ | int x; and void m() {} |
2 |
| C# | public int x; and void M() {} |
67 |
The fixture table is member_walk_siblings::FIXTURES in src/observation_tests.rs.
Cause
src/metrics/npm/csharp.rs asks the primary-constructor question (#1828) of every node it is handed:
if let Some(list) = node.first_child(|id| id == ParameterList)
&& func_opener::is_callable(&list, code, ancestors.of_children(node).get())
A method_declaration has a parameter_list child, so the chain is derived for each method, then the row's parent gate answers "not under a type declaration" and the chain is dropped.
Cost
One allocation per method, constructor, local function and delegate. A derivation has been one allocation since #1805, so this is a constant factor that the scaling gate cannot price. It is the shape the_member_walks_derive_a_chain_per_body_not_per_node guards for Java only (lesson 103).
Suggested fix
Test the node's kind (the type declarations a primary constructor can sit under) before deriving the chain, or read the parent gate's answer from node itself. Then extend the per-body guard to C#, or to every row of the fixture table above.
Related
#1828, #1805, #1696, #1871.
- 主要言語
- Rust
- スター
- 32
- フォーク
- 3
- 平均マージ
- 9時間 55分
- マージ済み PR(30日)
- 102
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dekobon/big-code-analysis のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dekobon/big-code-analysis#1887 ·
メンテナーはふだん 1 日以内に返信
-
documentation low-priority
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dekobon/big-code-analysis#1883 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
dekobon/big-code-analysis#1458 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
dekobon/big-code-analysis#1444 ·
メンテナーはふだん 1 日以内に返信
-
security upstream-grammar
難易度 2/5 1時間未満 初心者へのやさしさ 75/100
dekobon/big-code-analysis#1058 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
dekobon/big-code-analysis の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ElectronicWave/Elemental#252 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
area:mcp effort:low P5 source:agent
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
jlcodes99/cockpit-tools#3103 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
eliasstravik/herdr-projects#1032 ·