microsoft / microsoft/TypeScript
Performance of getSemanticDiagnostics in compiler API
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
The setup is somewhat similar to the one in the compiler API example (https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#incremental-build-support-using-the-language-services)
The problem, as in the example, is that errors are reported only for files that were directly changed. It doesn't cover the case in which the changed file was a dependency of another file, and even though the file depending on it was not changed, it will still have errors, which won't be reported.
To be more specific, the setup I am talking about is ts-loader + webpack.
What happens is that getSemanticDiagnostics(file) has to be called for every file in the project, which ends up increasing the incremental build times considerably. Even program.getSemanticDiagnostics() iterates through all of the source files as it is seen in the typescript source code.
I can only see this problem fixed from the compiler API. It could expose a method which finds all files dependent on a given file. Because in an incremental build only a single file changed, this should be faster than calling getSemanticDiagnostics() for each and every project file.
The alternative would be some sort of caching on getSemanticDiagnostics() itself, but the compiler would probably have to do internally the same work as above to invalidate the cache on file change. This seems to be equivalent to a getSemanticDiagnosticsForFileAndDependents(file)-like function.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、getSemanticDiagnostics(file) と program.getSemanticDiagnostics() の TypeScript compiler API の実装を読みます。issue で参照されているソースコードも含めてください。インクリメンタルビルドが、変更されたファイルに依存するファイルをどのように特定しているかを確認し、そのうえで、プロジェクト内のすべてのファイルをチェックせずに、影響を受けるすべての診断を報告できる API またはキャッシュのアプローチを評価します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- api, compilers, performance
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100