Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builder.getDeclarationDiagnostics performance regression since 5.6 #60970

Open
alan-agius4 opened this issue Jan 14, 2025 · 1 comment
Open
Assignees
Labels
Needs Investigation This issue needs a team member to investigate its status.

Comments

@alan-agius4
Copy link
Contributor

alan-agius4 commented Jan 14, 2025

🔎 Search Terms

Starting with version 5.6, the builder.getDeclarationDiagnostics method has become slower when invoked to retrieve diagnostics for a single SourceFile.

Here are the timing comparisons:

TypeScript Version: 5.5.2

  • builder.getDeclarationDiagnostics(): 2.247s
  • builder.getDeclarationDiagnostics(builder.getSourceFiles()[0]): 0.19ms
  • builder.getSourceFiles().forEach(sf => builder.getDeclarationDiagnostics(sf)): 1.655s

TypeScript Version: 5.7.2

  • builder.getDeclarationDiagnostics(): 1.675s
  • builder.getDeclarationDiagnostics(builder.getSourceFiles()[0]): 1.791s
  • builder.getSourceFiles().forEach(sf => builder.getDeclarationDiagnostics(sf)): 2.824s

🕗 Version & Regression Information

💻 Code

https://github.com/alan-agius4/ts-getDeclarationDiagnostics

🙁 Actual behavior

Regression in performance

🙂 Expected behavior

Similar performance

Additional information about the issue

No response

@alan-agius4
Copy link
Contributor Author

alan-agius4 commented Jan 15, 2025

What is interesting using typeScriptProgram.getDeclarationDiagnostics yields a different outcome

TypeScript Version: 5.5.2
typeScriptProgram.getDeclarationDiagnostics(): 2.237s
typeScriptProgram.getDeclarationDiagnostics(builder.getSourceFiles()[0]): 0.191ms
builder.getSourceFiles().forEach(sf => typeScriptProgram.getDeclarationDiagnostics(sf)): 1.994s

TypeScript Version: 5.7.3
typeScriptProgram.getDeclarationDiagnostics(): 1.664s
typeScriptProgram.getDeclarationDiagnostics(builder.getSourceFiles()[0]): 0.101ms
builder.getSourceFiles().forEach(sf => typeScriptProgram.getDeclarationDiagnostics(sf)): 1.721s

alan-agius4 added a commit to alan-agius4/ng-packagr that referenced this issue Jan 15, 2025
Replaced `builder.getDeclarationDiagnostics` with `typeScriptProgram.getDeclarationDiagnostics` to avoid performance issues introduced in TypeScript 5.6+ reported in microsoft/TypeScript#60970

Closes ng-packagr#2969
alan-agius4 added a commit to ng-packagr/ng-packagr that referenced this issue Jan 15, 2025
Replaced `builder.getDeclarationDiagnostics` with `typeScriptProgram.getDeclarationDiagnostics` to avoid performance issues introduced in TypeScript 5.6+ reported in microsoft/TypeScript#60970

Closes #2969
@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

No branches or pull requests

3 participants