Skip to content

Building performance is slowdown #28025

Closed

Description

@thekiba

TypeScript Version: 3.2.0-dev.201xxxxx

Search Terms:
performance, slowdown, degradation

Code:
After upgrading to typescript 3.1.3, our application has been building for a very long time. The total time has increased tenfold. By profiling the build, I found the reason for the slowdown in performance.

screenshot 2018-10-21 at 16 19 02

The screenshot shows a call to this method:
https://github.com/Microsoft/TypeScript/pull/26192/files#diff-08a3cc4f1f9a51dbb468c2810f5229d3R968

oldProgramState.program.getSourceFiles().find(...)

When I rolled back the commit changes, the performance problem was solved. But I don’t know how to fix that and so that the PR assertion pass:
https://github.com/Microsoft/TypeScript/pull/26192/files#diff-6f2ace9c4058a2bb2afe0560f9990e33R402

Expected behavior:
Performance improvement

Actual behavior:
Performance is slowdown

Related Issues:
#26192

Activity

  1. ajafff commented on Oct 21, 2018

    @ajafff
    Contributor

    Looking at that code again, I don't know how it could cause a noticeable slowdown. That would probably require thousands or millions of files in your program.

    How are you running tsc to hit that path of the code? tsc -w or some custom build tool?
    How many files are in your program? You can find out using --diagnostics flag of tsc.

  2. thekiba commented on Oct 21, 2018

    @thekiba
    Author

    The count of files in the project ~10k.

    I am using @angular/cli. And I tried to set the compilerOptions.diagnostics flag in tsconfig.json, but I don't receive any information.

  3. added a commit that references this issue on Oct 21, 2018
    ea0c7eb
  4. ajafff commented on Oct 21, 2018

    @ajafff
    Contributor

    After investigating further, it turns out this code may be executed for each import (or type reference directive) in every file of the project (depending on the kind of change).
    I have a fix up in #28028 to avoid iterating every file.

  5. thekiba commented on Oct 21, 2018

    @thekiba
    Author

    I build typescript from your pull request, and used it to build my application. Now the build time is the same as before.

    👍Thanks for the quick response.

  6. zorrme commented on Oct 26, 2018

    @zorrme

    Can we release this please ?

  7. added a commit that references this issue on Nov 1, 2018
    fd6565d
  8. DanielRosenwasser commented on Nov 1, 2018

    @DanielRosenwasser
    Member

    This should be available in TypeScript 3.1.6. Thanks Klaus Meinhardt (@ajafff)!

  9. Manish3177 commented on Nov 5, 2018

    @Manish3177

    Could we get updated VS installer for 3.1.6: https://www.microsoft.com/en-us/download/details.aspx?id=55258?

  10. Manish3177 commented on Nov 16, 2018

    @Manish3177

    Pinging again. It's not obvious how to apply the contents of 3.1.6 source on top of the installer linked above. Is it just a matter of copying over and overriding tsc.js+tsc.exe? Is there anything else that needs to be copied over? At the very least, I'd like to hear from one of the devs that it won't break anything. A diff of tsc.js between the two version really lights up because the source contains comments.

  11. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: PerformanceReports of unusually slow behaviorFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions