Skip to content

transformTime performance regression since 5.6.x #61406

@valentinmelusson

Description

@valentinmelusson

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.

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions