microsoft / microsoft/TypeScript

`transformTime` performance regression since 5.6.x

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

@sheetalkamat がすでに取り組んでいます。

2025年3月20日 から。

Needs Investigation
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

Context
Issue was discovered when updating typescript from 5.5.4 to 5.7.3 for our frontend repository at Datadog, after checking our typecheck graph where you can see the global bump :

Image

We have ~9.7M lines of typescript code. We won't be able to give a repro case as this occurred on our whole codebase, but we'll try to give as much detail as possible.

Regression
To typecheck our codebase, we first typecheck our packages (by package we mean small independents folders with their own tsconfig.json and package.json), and build the .d.ts files for each one of them. We then run typecheck on the rest of our codebase, which is a monolith, in build mode to use the previously built declaration files. The part that undergo an increase in time is the last one, on the monolith. The typecheck job for packages remained stable.

We are collecting extended diagnostics metrics when running our typecheck jobs to be able to monitor the different phase.
After investigation, we discovered that the biggest part of this newly added extra-time was due to the transformTime phase going from none in 5.5.4 to ~4min20s after updating to 5.7.3, even though we are setting noEmit:true and emitDeclarationOnly:false. (this transform phase was previously skipped).
There was no modification in any compiler options during this update.

Here is a visual representation of the time bump on our Datadog graphs (as detailed in the legend, the yellow part is the transformTime) :

Image

Potential source
After taking a look at the changes between the said versions, we found this PR that apparently updated the compiler to always emit declarations even with --noEmit, to fix some correctness issues (so that --noEmit still shows declaration diagnostics)

  • On 5.5.4, transformTime was not even appearing in the extended diagnostic report
Image
  • On 5.6.2, the ~4min20s were in the report, under the transformTime time field (here it's the local run, so it's only ~3min ) :
Image

We have tried to modify some compiler options without success, and we haven't found an official flag to revert to the old compiler behavior in order to avoid this extra time while staying on the updated 5.7.3 version. We don't have other idea for a short term solution, hence this issue.

Acknowledgement
  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

評価

この issue はまだ評価されていません。

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

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