microsoft / microsoft/TypeScript

`transformTime` performance regression since 5.6.x

Đang mở
#61,406 11 bình luận 27 reaction 1 người được giao Xem trên GitHub

@sheetalkamat đang làm issue này rồi.

Từ ngày 20/3/2025.

Needs Investigation
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

**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](https://github.com/microsoft/TypeScript/pull/59065) 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

- [x] I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.