aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.49k stars 418 forks source link

performance: avoid file watchers #3216

Closed justinmk3 closed 11 months ago

justinmk3 commented 1 year ago

Problem

Toolkit has various file watchers for SAM template.yaml files, CDK, etc. These can negatively affect performance.

Solution

  1. Introduce settings to limit the cost of Toolkit file watchers:
  2. ✅ exclude files/directories specified by vscode search.exclude, files.exclude settings. https://github.com/aws/aws-toolkit-vscode/pull/3770
  3. ✅ Change template.yaml detect to be on-demand instead of eager (omnipresent, filewatcher-driven)
    • When a template.yaml is needed but not found (such as "SAM run/debug", and "Sync SAM" command), mention this in the info message. (Related: #3211)
    • Implemented in #3931 + #3962
justinmk3 commented 1 year ago

The "schema service" in particular can be a complete show-stopper if your workspace has many big projects (which... may contain... yaml files):

2023-03-27 19:46:16 [DEBUG]: schema service: handle yaml mapping: sam -> file:///projects/sam-installation/aws-sam-cli-src/tests/smoke/templates/sar/s3-uncompressor-template.yaml
2023-03-27 19:46:16 [DEBUG]: schema service: handle yaml mapping: sam -> file:///projects/sam-installation/aws-sam-cli-src/tests/smoke/templates/sar/alexa-skills-kit-color-expert-template.yaml
2023-03-27 19:46:16 [DEBUG]: schema service: handle yaml mapping: sam -> file:///projects/sam-installation/aws-sam-cli-src/tests/smoke/templates/sar/SecretsManagerRedshiftRotationSingleUser-template.yaml
2023-03-27 19:46:17 [DEBUG]: schema service: handle yaml mapping: sam -> file:///projects/sam-installation/aws-sam-cli-src/tests/smoke/templates/sar/magic-8-ball-template.yaml
2023-03-27 19:46:17 [DEBUG]: schema service: handle yaml mapping: sam -> file:///projects/sam-installation/aws-sam-cli-src/tests/smoke/templates/sar/SecretsManagerMongoDBRotationSingleUser-template.yaml
2023-03-27 19:46:17 [DEBUG]: schema service: handle yaml mapping: sam -> file:///projects/sam-installation/aws-sam-cli-src/tests/smoke/templates/sar/AmazonConnectSalesforceLambda-template.yaml
<100s more...>

Exacerbated by https://github.com/aws/aws-toolkit-vscode/issues/3259 ?

This thing even drills into node_modules :( (Update: https://github.com/aws/aws-toolkit-vscode/pull/3440 )

2023-03-31 08:49:16 [DEBUG]: schema service: handle yaml mapping: [removed] -> file:///Volumes/workplace/aws-toolkit-vscode/node_modules/buffer/.travis.yml
2023-03-31 08:49:16 [DEBUG]: schema service: handle yaml mapping: [removed] -> file:///Volumes/workplace/aws-toolkit-vscode/node_modules/buffer/bin/zuul-es6.yml
...
justinmk3 commented 11 months ago

Item 3 in the above list was implemented in #3931 + #3962.

File watchers are still not fully avoided though. That's tracked elsewhere, so closing this issue.