Repository navigation
3.4.1 tsc works 20! times slower than 3.3.4 #30663
Description
Activity
Same here. I also got some significant performance hit in my front-end build (and I'm also using
styled-components).Reacted by Fonger, Miha Sedej, Paul, Jason Galea, Aleksi Pekkala, Daniel Schopf, Michael Stramel, Bas Slagter, Josiah Nunemaker, Kai Kulju and 11 moreSame here, rollback to TypeScript
3.3.xtemporary fixed the problem.Same issue here, switched back to
3.3.x- addedNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.
on Apr 1, 2019 I have investigated this with TypeScript 3.4.1, and the issue does not show up (for me) with @types/styled-components v4.1.10, but does happen with @types/styled-components v4.1.11. The change between these two versions is related to distributing over union types. Perhaps this helps figure it out.
Reacted by ulrichb, Timm Preetz, Sebastian "Sebbie" Silbermann, Sean Matheson, Alexander Kachkaev, SlurpTheo, Aleksey Levenstein and Thiago ArmedeReacted by Timm PreetzI tried downgrading to @types/styled-components v4.1.10, but still see unbelievable slowdown on TS versions >= 3.4.0.
It's a big project, with lots of dependencies so it's hard to pinpoint what exactly is triggering it, but right now compilation is so slow that development is nearly impossible – 80 seconds for every compile, 75 secs in type checking. WebStorm can't even recompile the code because of the timeouts. Fans are spinning like crazy on i7, 4x2 HT cores, 42 GB RAM, 4GB node heap iMac. I don't think we can wait until 3.5.0 for the fix, it would just mean that we would just need to skip 3.4.0 entirely. Disabling strict function type checking is a very radical decision for a complex project.
Reacted by Panjie Setiawan Wicaksono, Denis Sokolov, Kuroné Kito (黒音キト), Fonger, Blake Williams, Je Xia, ivan, Eugene Draitsev, Martin Daniel Kolpak, Kai Kulju and 5 more- added a commit that references this issue
on Apr 2, 2019 I can confirm that a downgrade to
@types/styled-components@4.1.10seems to solve the perf issue.Wesley Wigham (@weswigham) So could you maybe revert the concerned commit (probably 6605356e) in the styled-components typings to workaround this issue?
EugeneDraitsev commented
on Apr 2, 2019 AuthorMore actionsulrichb I checked downgrade seanario to
@types/styled-components@4.1.10and it still works slower with TypeScript 3.4, but at least not 20times slower, only 2.5 times:My observations of the front-end build times (
react-scripts build) in a mid-size project:- TS 3.4.4000: ~ 2 min 20 sec
- TS 3.4.1 and @types/styled-components 4.1.12: ~ 3 min 40 sec (+ 1 min 20 sec)
- TS 3.4.1 and @types/styled-components 4.1.10: ~ 2 min 40 sec (+ 20 sec)
@ TS Team: Note that my problem is not really the additional ~1 min 20 sec in the build script, but that my IDE (WebStorm) time-outs during type-checking => so I don't get any red squiggles in TSX modules containing styled-components (which concerns almost my whole front-end code base) :/ A downgrade to styled-components 4.1.10 solves/workarounds this issue.
EugeneDraitsev commented
on Apr 2, 2019 AuthorMore actionsulrichb you compared build time, but not
tsctime. The main problem here right now, that typecheking with IDE or by cli works significantly slower, or 2-2.5 times slower if you will use@types/styled-components 4.1.10. On mid-size project I have ~4s vs ~12s on@types/styled-components 4.1.10. This timings are still kind of workable, but it should be the same as on 3.3.4000 (or at least +5-20% of it)Yesterday, without looking for the issue in this repo, I opened this issue in @types/styled-components DefinitelyTyped/DefinitelyTyped#34391.
Michelle Saad (@michsa) saw that the performance change was done between the builds
typescript@3.4.0-dev.20190223(working normally) and3.4.0-dev.20190226(taking a long time)Maybe it's worth to cross the info on both threads to find down the root of this issue.
Reacted by ulrichb, Sebastian "Sebbie" Silbermann, Fonger and Josep M SobrepereReacted by Michelle Saad34 remaining items
I am using
typescript@3.5.0-dev.20190512tsc --noEmitStill a memory leak and crash.
Reacted by Mick F, Joseph Silverman, Aliaksei Kislou, Antoine Rousseau and Jakub ChrzanowskiStill a memory leak and crash
You have a repro you can share?
- added a commit that references this issue
on May 14, 2019 Mike Erickson (@FishOrBear) Your crash is fixed in the latest nightlies and the
rc.Wesley Wigham (@weswigham)
Thank you, I have tried the latest package, now there is no problem.Hi there, I'm trying to fix this issue myself and having a hard time understanding which versions of @types/styled-components, etc. to use to solve the problem. I'm currently using:
react-scripts@3.0.1
@types/styled-components@^4.1.14
styled-components@^4.2.0
typescript@^3.5.1I'm using VS Code and still having some noticeable delays for things like underlining type errors in files that use styled-components. Commenting out any styled components removes the delay. Am I missing a package upgrade somewhere?
Actually I just figured it out. My VS Code workspace was still using 3.4.5. Changing the workspace to use 3.5.1 fixed the problem.
Reacted by Kaelig Deloumeau-Prigent, Wesley Wigham and Minh LeReacted by Recep TiryakiHaving a similar issue. See react/create-react-app#7003
If you're still on an older version of TS that has the problem, you're still going to have the issue ❤️
I'm going to lock this issue - anyone with a perf problem on the latest version of TS has a distinct and different problem and should open a new thread. Anyone finding this from google search results and is looking for a solution - try using TS 3.5+ (and then if your problem persists, let us know in a new issue), or try downgrading your
@types/styled-componentsversion to4.1.14(if you must stay on an older version of TS), thanks~- locked as resolved and limited conversation to collaborators
on Jul 1, 2019 - addedBugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueand removedNeeds InvestigationThis issue needs a team member to investigate its status.This issue needs a team member to investigate its status.
on Jul 1, 2019


TypeScript Version: 3.4.1
Search Terms:
tsc, slow, typecheck, 3.4.1, styled-components
Code
I have simple typecheck script in my package.json:
It work 20 times slower on 3.4.1, than on 3.3.4000 (91s vs 4.5s)

It's almost impossible to work with that, because IDE almost can't analyse anything in this conditions. I have same behaviour on MacOS 10.14.3 and on Windows 10
My tsconfig file:
{ "compilerOptions": { "target": "es5", "lib": [ "dom", "dom.iterable", "esnext" ], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "jsx": "preserve" }, "include": [ "src" ] }EDIT: I found the reason of this slowness - styled-components, so faster way to reproduce this issue: (also online demo added below)
yarn create react-app my-app --typescript cd my-app yarn add styled-components @types/styled-componentsadd to
src/index.tsx:add in package json tsc script in scripts section:
run
yarn tscif you'll downgrade typescript version to 3.3.4000 or comment 2 lines of code in
src/index.tsxit will work 20 times fasterExpected behavior:
It should works with same acceptable time
Actual behavior:
It works 20 times slower
Playground Link:
I will try to create reproducible example, but I have pretty simple react CRA 2.0 application.
EDIT: Reproducible demo here: https://repl.it/@EugeneDraitsev/slow-tsc-341
3.3.4000:

3.4.1:

Related Issues: