microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
744 stars 245 forks source link

Slow performance after AL Language update #5768

Closed aobsgit closed 4 years ago

aobsgit commented 4 years ago

Describe the bug When coding VS Code is a lot less responsive in suggestions, compiling, saving etc.

To Reproduce Just start coding.

Expected behavior To be at least as mush responsive as it was before last update.

Screenshots

5. Versions:

atoader commented 4 years ago

Please provide a project to reproduce the issue and with a comparison of the performance before and after. We have not noticed this internally so there might be something particular to your solution that is causing the regression.

aobsgit commented 4 years ago

Could you please elaborate what exactly do you mean by "project"? It also seems a system problem since CPU consumption is very high due to Microsoft.Dynamics.Nav.EditorServices.Host process.

However, we are working on 15.4. W1. After downgrading to AL 4, things are normal again.

yrest commented 4 years ago

@aobsgit what other extensions do you have installed/ enabled on vs code? Try uninstalling everything and leave only AL to see if it makes a difference?

aobsgit commented 4 years ago

@yrest the "standard" ones for AL development. I will try that.

gregoral commented 4 years ago

We have also noticed a significant slowdown when AL compiler returns a lot of warnings. Since newer version of alc return a lot of warnings, which have to be fixed this is potentially an issue. We deal with it by switching some warnings off using a ruleset file.

aobsgit commented 4 years ago

We have also noticed a significant slowdown when AL compiler returns a lot of warnings. Since newer version of alc return a lot of warnings, which have to be fixed this is potentially an issue. We deal with it by switching some warnings off using a ruleset file.

Nope, that was not the case here. Warnings were solved by correcting them or ignoring them as you suggested.

anwar0206 commented 4 years ago

We too are experiencing the sluggish performance of AL.

We have 838 .al files in our project. Extensions Enabled in VS Code AL Language.

When we address any Warning/Error. AL takes long time to reduce the Warning count (Some times it takes 15 minutes to show the correct warning count).

Noticed that in Problem window shows once character at the time. Even when we are finished typing the whole line the problem window shows that we are typing.

mfalk118 commented 4 years ago

I am also going crazy with this new version pulling my hair. It should be very easy for Microsolft to find reproduction scenarioes. I would assume all developers working at MS experiences this.

But one of my findings: Double click a warning, the edsitor jumps to the file, then

  1. All warnings disaapears
  2. CPU goes to 100% for about 10seconds
  3. Warnings comes back. This is in a project with app. 200 files, and currently 53 warnings
atoader commented 4 years ago

Do you have code analysis enabled? Are you using any of the code cops?

mfalk118 commented 4 years ago

Yes offcourse :-) "al.enableCodeAnalysis": true, "al.codeAnalyzers": [ "${CodeCop}", "${UICop}" ], And yes i assume these are contributing to the problem, however, they are also really nice to have on, so we can make better code.

atoader commented 4 years ago

I agree that they are nice, but as there are hundred of rules on in that collection, we recommend turning them off is performance is what you care about https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-optimize-visual-studio-code

Another issue is that the analyzer framework does not currently support incremental analysis which exhibits some of the problems you have mentioned.

mfalk118 commented 4 years ago

Hmm OK, But is there a way to run the code analysis manually then, like AL: Package?

atoader commented 4 years ago

You can leave the analyzers enabled, but set "al.backgroundCodeAnalysis": false

mfalk118 commented 4 years ago

OK, that seems to help. However is there any way to get the warnings into the Problem window, and not just in the output window on build? I think it is a bit easier to overlook the warnings in the Problem window?

atoader commented 4 years ago

Unfortunately, that is not supported. The Ctrl+Shift+B build is actually in a separate task that is decoupled from VSCode.

mfalk118 commented 4 years ago

OK, is there already a feature request for incremental analysis, or should i make one?

atoader commented 4 years ago

There is a slice in our backlog to address it, but it is not planned for the near future.

atoader commented 4 years ago

You might want to open a BC idea if one is not already present. That will help us get an understanding of how much the community needs this relative to other features.

mfalk118 commented 4 years ago

Ok thanks. I will consider this

aobsgit commented 4 years ago

Even after today's upgrade, we are still unable to work normally with background analysis set.

atoader commented 4 years ago

We do not have any work planned for the upcoming release to improve performance in this area. Please go ahead and post this to our Ideas forum at https://aka.ms/BusinessCentralideas, or vote up the idea if its already there. This will help us allocate time and resources for improving this scenario.