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

[Mac] Performance Issues - tsserver.js #72499

Closed
jrobber opened this issue Apr 17, 2019 · 13 comments
Closed

[Mac] Performance Issues - tsserver.js #72499

jrobber opened this issue Apr 17, 2019 · 13 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@jrobber
Copy link

jrobber commented Apr 17, 2019

  • VSCode Version: VSCode Insiders
  • OS Version: Mac 10.14.3

Steps to Reproduce:

  1. Open Multiple files

Does this issue occur when all extensions are disabled?: Yes

Per this thread : #71886, I am starting a new thread because my performance problems are persisting after following all the recommended steps.

  • I am running the insiders build
  • I updated typescript to 3.3.4000
  • Terminal Render to DOM
  • Updated styled components to 4.1.14
  • Deleted typescript cache folder
  • Restarted VS code with no extensions

My project is a javascript project. My process don't stay spiked, but every file I open seems to add 20-60 seconds on to the duration of the spike. So trying to drill down into my code and flipping back and forth gets me to a point where I just have to kill VS Code and start over to get any progress made.

Here is the aux dump making me suspect tsserver.js :

 2019-04-17 08:47:18 ⌚  Jeremys-MBP-2 in ~/src/yoodlize-core
± |master → origin ↑4 {4} U:71 ✗| → ps aux | grep 22524
Robertson        22524 109.5  6.2  6099928 1035508   ??  R     9:31AM   0:31.86 /private/var/folders/l7/83s96gnn1d18d1wk74m8_ghh0000gn/T/AppTranslocation/0462F3DD-3E46-4376-A963-9DC576A1734C/d/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper.app/Contents/MacOS/Code - Insiders Helper /private/var/folders/l7/83s96gnn1d18d1wk74m8_ghh0000gn/T/AppTranslocation/0462F3DD-3E46-4376-A963-9DC576A1734C/d/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /var/folders/l7/83s96gnn1d18d1wk74m8_ghh0000gn/T/vscode-typescript/tscancellation-66f492546fb0aa693f0d.tmp* --locale en --noGetErrOnBackgroundUpdate
Robertson        22547   0.0  0.0  4268036    804 s004  S+    9:32AM   0:00.00 grep --color=auto 22524
@vscodebot vscodebot bot added the typescript Typescript support issues label Apr 17, 2019
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 17, 2019

Can you please try collecting the TS Server logs to help us investigate:

  1. Set "typescript.tsserver.log": "verbose",
  2. Restart VS Code and reproduce the problem
  3. In VS Code, run the TypeScript: Open TS Server log command
  4. This should open a folder with a tsserver.log file in it

If you can share the log, I can also take a look to see if anything stands out.

⚠️Warning: The TypeScript log may include information from your workspace, including file paths and source code. If you have any concerns about posting this publicly on Github, just let me know and we can arrange something else. On our side, we only use these logs to investigate issues like this

@jrobber
Copy link
Author

jrobber commented Apr 17, 2019

Here is the tsserver.log : https://gist.github.com/jrobber/56dc8d986e7127f6592ec2ce770eceb3.

Please, let me know when you're done so I can take it down.

@mjbvz

@mjbvz
Copy link
Collaborator

mjbvz commented Apr 17, 2019

Thanks @jrobber. I've taken a look at the logs

Nothing stands out from my first look but one thing you should try is creating a jsconfig.json in your project. I see a few javascript files from under node_modules being included in what VS Code infers and your project. Creating a jsconfig should prevent that

@mjbvz mjbvz added the info-needed Issue requires more information from poster label Apr 17, 2019
@jrobber
Copy link
Author

jrobber commented Apr 18, 2019

I added the following jsconfig.json, then restarted VSCode with no extensions :

{
  "include": ["src/**/*"]
}

And the same problem/behavior persists. Any call to intellisense, auto-complete, or opening multiple files puts the CPU at over 100% for code helper. Happy to arrange a screen share or perform any other tests you can think of.

@jrobber
Copy link
Author

jrobber commented Apr 18, 2019

I had to work in a different project and noticed that the problem does not happen in that project. That project is react native and does not use styled components. Made me wonder if this is related to the styled components issues linked to in the original thread. So, I followed the steps again from that thread and I'm still seeing the huge CPU spikes in this project.

@lukasz-madon
Copy link

@jrobber it happens for me when I open a file with a lot of template strings, don't have to be styled components. Code Helper stops using CPU after an hour. It looks like building the cache is slow. I cannot reproduce it with a single file so maybe it's something that compounds.

e.g.

  const content3 = `# FIRST COURSE
> Host to select one option to serve guests
- **House Salad**
- **Assorted Pizzas** 
- **Calamari** 
- **Risotto** 
- **Mixed Green Salad**
- **Beet Salad**
- **Caesar Salad**
- **Chopped Wedge Salad**
- **Antipasto Salad**

# SECOND COURSE
- **Brown Butter Tortellini** 
- **Penne Con Salsiccia** 
- **Farfalle** 
- **Papardelle Ragu** 
- **Chicken Alfredo**
- **Chicken Parmesan**

# DESSERT
- **Cheesecake**
- **Gelato**
- **Sorbetto**`;

@jrobber
Copy link
Author

jrobber commented Apr 19, 2019

I can trigger it by pressing ctrl+space in a small file like this one :

import React from 'react';
import { Text, Whitespace } from '../../components_new/common';
import Button from '../../components_new/common/FormComponents/Button';
import history from '../../core/history';

export default class VerifiedThanks extends React.Component {
  render() {
    const { isMobile } = this.props;
    return (
      <div className="f f-1 f-cc f-rows">
        <div className="f f-cc f-rows">
          <Text h4>Email confirmed!</Text>
          <Whitespace small />
          <Text>Your email is confirmed and you're ready to roll!</Text>
          <Whitespace small />
          {!isMobile && (
            <Button primary action onClick={() => history.push('/login')}>
              Login
            </Button>
          )}
          <Whitespace small />
          {isMobile && (
            <a href="yoodlize://">
              <Button primary action>
                Back to App
              </Button>
            </a>
          )}
        </div>
      </div>
    );
  }
}

There are no template strings in the file. But it definitely lasts a lot less long than files with template strings.

@SeanRoberts
Copy link

Downgrading to 1.32.3 seems to have resolved this issue for me. I experienced it with 1.33 and 1.33.1. I also am using React and frequently using tagged template strings (styled-components) but the problem occurred even in files without any styled components.

@jrobber
Copy link
Author

jrobber commented Apr 27, 2019

Downgrading seems to have helped/resolved this issue for me as well. I've been watching it the last few days and while VSCode still gets in spurts of very high CPU it's much less frequent and not triggered every time I open a few files. I'll keep an eye on the spikes and see if I can gather any more information.

@arthur-chan-leapyear
Copy link

I can confirm as well that the issue appears to be in 1.33. We are pinning our cookbooks to 1.32, and will watch this issue before testing newer versions.

@alexpattison
Copy link

Downgrading to 1.32.3 also solved this issue for me. Upgrading to latest @types/styled-components and deleting the cache as suggested in other issues didn't help.

@mjbvz
Copy link
Collaborator

mjbvz commented May 14, 2019

Sounds like this could be microsoft/TypeScript#31341

To check this, can you please try upgrading your workspace to use the next typescript@next that is published (3.5.0-dev.20190513+) by following these instructions

@mjbvz
Copy link
Collaborator

mjbvz commented May 22, 2019

Closing as likely duplicate of microsoft/TypeScript#31341 / microsoft/TypeScript#30819.

The latest VS Code insiders build includes TypeScript 3.5 which should fix this. If you see see performance issues using TypeScript 3.5, please open a new issue so we can investigate

@mjbvz mjbvz closed this as completed May 22, 2019
@mjbvz mjbvz added *duplicate Issue identified as a duplicate of another issue(s) freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels May 22, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

6 participants