microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101k stars 12.48k forks source link

[Performance regression] Performance regression in Typescript 5.1 on large files #60353

Open moufmouf opened 1 week ago

moufmouf commented 1 week ago

πŸ”Ž Search Terms

performance regression, Typescript 5.1

πŸ•— Version & Regression Information

⏯ Playground Link

https://github.com/moufmouf/typescript-perf-issue

πŸ’» Code

See Github repo for the code sample (the issue is that very big files take wayyyyy longer to be analyzed)

πŸ™ Actual behavior

The issue is that the compilation time of some very large files (22k lines) has increased significantly between v5.0 and v5.1 (and is still very long in the latest 5.6 release)

The file I'm trying to compile is 22k lines long.

Compilation time in v5.0: 6s. Compilation time in v5.1: 110s.

This is a 18x increase.

I generated trace files but I don't know how to interpret them.

Tracefile for 5.0: traceDir_5.0.log Tracefile for 5.1: traceDir_5.1.log

πŸ™‚ Expected behavior

The analysis time would not greatly differ between 5.0 and recent releases.

Additional information about the issue

The file that is suddenly taking very long to analyze was generated using ts-proto.

I could perfectly disable the analysis for this file (since it was autogenerated) but there is probably an underlying issue.

For the record, the original file comes from the WorkAdventure project (https://github.com/workadventure/workadventure)

s3xysteak commented 1 week ago

After updating to vscode@1.95, the Typescript IntelliSense is so slowπŸ˜₯. I'm not sure is that related to this issue.

jakebailey commented 1 week ago

@s3xysteak TypeScript 5.1 was ages ago. If things got slower when updating to this month's VS Code version, your issue is definitely not this issue.