microsoft / microsoft/TypeScript
`transformTime` performance regression since 5.6.x
@sheetalkamat is already working on this.
Since Mar 20, 2025.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
**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 :
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`) :
**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
- 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 ) :
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.