Consider replacing `foreach` on IList/List with `for` loop
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- csharp
- 領域
- performance
調査の方向性
Parser/TSql/TSql150Parser.cs の 89 行目と 115 行目付近にある foreach ループから始めます。次に tools/AstGen/ClassDescription.cs の 249 行目と 260 行目付近を調べ、IEnumerable へのキャストと子要素の反復処理を含めて確認し、生成されたコードをたどって追加の IList ループを探します。IList/List の対象となる反復処理が、パーサーの動作や生成される出力を変更せずにインデックスアクセスを使用すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
When parsing thousands of scripts foreach approach generates at least N * 2 unnecessary enumerators, e.g. in TSQL160Parser here and here.
Also somewhere in the deep of generated code it produces lots (~N*10) of enumerators on IList<Identifier> but I was unable to locate this place. It'd be great if this was fixed too.
Also please take a look at this IEnumerable implicit cast wherease the source is List and some code addressing this IEnumerable with foreach could be actually rewritten into more optimal for. And there is another suspicious foreach a couple of lines below which may affect iterating through children objects. Perhaps it will work faster and with less garbage objects for GC if implemented as for loop and index-based access to IList elements.
- 主要言語
- GAP
- スター
- 277
- フォーク
- 43
- 平均マージ
- 6日 17時間
- マージ済み PR(30日)
- 3
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/SqlScriptDOM のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/SqlScriptDOM#228 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
microsoft/SqlScriptDOM#183 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
microsoft/SqlScriptDOM#226 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
microsoft/SqlScriptDOM#225 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
microsoft/SqlScriptDOM#224 ·
microsoft/SqlScriptDOM の issue をすべて見る
似ている issue
-
todo:perf
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
tenstorrent/tt-metal#57320 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
mlcommons/mobile_app_open#1182 ·
-
[bug] skill review is quadratic in unmatched markdown brackets: a 64 KiB file of '[' takes 9.2 s オープンneeds-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100