AL icon indicating copy to clipboard operation
AL copied to clipboard

Intellisense is very slow.

Open davidatbinarystream opened this issue 2 years ago • 10 comments

  • Issue Type: Bug
  • Extension Name: al
  • Extension Version: 10.0.687650
  • OS Version: Windows_NT x64 10.0.19043
  • VS Code version: 1.71.2

:warning: We have written the needed data into your clipboard. Please paste! :warning:

When typing Ctrl + Space it takes at least 30 seconds for any intellisense suggestions to pop up, if they open at all.

davidatbinarystream avatar Oct 05 '22 00:10 davidatbinarystream

Confirmed. And it's not only the intellisense. VS Code slows down to a crawl with large workspaces open. When you roll back to the last v9 build, everything is fine again.

erikrijn avatar Oct 05 '22 07:10 erikrijn

Maybe it has something to do with the rule AA0241 Deactivating this role makes it a little bit faster again

The rule now checks the variable types and it looks to me that this is new.

BernhardKloibmueller avatar Oct 05 '22 08:10 BernhardKloibmueller

Confirmed, after upgrading AL Code to v10.0.687650 VS Code became too slow. I had to downgrade to the previous version and it works fine.

fgilsc avatar Oct 05 '22 08:10 fgilsc

Thanks for the update Erik, let me know if you need any information that will make it easer to debug.

From: Erik van Rijn @.> Sent: October 5, 2022 12:53 AM To: microsoft/AL @.> Cc: David Aldis @.>; Author @.> Subject: Re: [microsoft/AL] Intellisense is very slow. (Issue #7190)

Confirmed. And it's not only the intellisense. VS Code slows down to a crawl with large workspaces open. When you roll back to the last v9 build, everything is fine again.

Reply to this email directly, view it on GitHubhttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FAL%2Fissues%2F7190%23issuecomment-1268078445&data=05%7C01%7Cdavid%40binarystream.com%7C4bec2b12dbd64ede5afc08daa6a6ade5%7Cdd24e63d21314bd0bdd5570c473ba440%7C1%7C0%7C638005532067110200%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zWTSJlRsJPmneb2kZCuijNk%2BdWaRwp%2Fdclq9Zj9qi3s%3D&reserved=0, or unsubscribehttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARBYP552NOCWZ6ZW3PKNYLTWBUXXHANCNFSM6AAAAAAQ5CD7QY&data=05%7C01%7Cdavid%40binarystream.com%7C4bec2b12dbd64ede5afc08daa6a6ade5%7Cdd24e63d21314bd0bdd5570c473ba440%7C1%7C0%7C638005532067110200%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=nrDtNQLXjGHHQ%2ByyvUdzGWINrW9KKFRCDvu8akB1LYQ%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.@.>>

davidatbinarystream avatar Oct 05 '22 16:10 davidatbinarystream

Thanks Bernhard, I will try that and let you know if that helps.

From: BernhardKloibmueller @.> Sent: October 5, 2022 1:21 AM To: microsoft/AL @.> Cc: David Aldis @.>; Author @.> Subject: Re: [microsoft/AL] Intellisense is very slow. (Issue #7190)

Maybe it has something to do with the rule AA0241 Deactivating this role makes it a little bit faster again

The rule now checks the variable types and it looks to me that this is new.

Reply to this email directly, view it on GitHubhttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FAL%2Fissues%2F7190%23issuecomment-1268107330&data=05%7C01%7Cdavid%40binarystream.com%7C612d9254a88a4846cfdf08daa6aa8e06%7Cdd24e63d21314bd0bdd5570c473ba440%7C1%7C0%7C638005548738857924%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=iKd%2FCvm61sj4MCHuQi0VId6fYGGFQG0KIV7uvkvdpzo%3D&reserved=0, or unsubscribehttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARBYP56Q67M3B6EEMCMPANTWBU27HANCNFSM6AAAAAAQ5CD7QY&data=05%7C01%7Cdavid%40binarystream.com%7C612d9254a88a4846cfdf08daa6aa8e06%7Cdd24e63d21314bd0bdd5570c473ba440%7C1%7C0%7C638005548738857924%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=JLByNTNqUbyQMsV%2Fe1uikaY1e%2FYzD5sac81FegNcvRQ%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.@.>>

davidatbinarystream avatar Oct 05 '22 16:10 davidatbinarystream

VS Code overall is nearly unbearable for a few of us, so slow and eventually stops code-analysing properly (or at any reasonable speed) and has to be restarted even more than normal just to be usable for some minutes at a time :-(

dzzzb avatar Oct 10 '22 15:10 dzzzb

I can confirm as well. The difference between AL v9 and the current AL 10.0.687650 is abominal. Unfortunately, the suggestion from @BernhardKloibmueller does not help either (there is no noticable difference for me, but thanks anyway for the suggestion! 😉).

rvanbekkum avatar Oct 12 '22 12:10 rvanbekkum

Unfortunately @BernhardKloibmueller suggestion doesn't help :(

LoanVision avatar Oct 12 '22 20:10 LoanVision

@rvanbekkum, @LoanVision I am sorry it seems that I was experiencing something different. Due to the other problems with v10.* we downgraded our compilers after I wrote the message so I was not able to verify my own suggestion in daily work. I was certain it was improving the work after deactivating, I was wrong, sorry for the misleading info

BernhardKloibmueller avatar Oct 13 '22 05:10 BernhardKloibmueller

Does disabling code analysis have any effect on the speed of intellisense and the projects in general?

BazookaMusic avatar Oct 13 '22 11:10 BazookaMusic

Has anyone tried disabling the code actions? https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-code-actions#to-enable-al-code-actions

NKarolak avatar Oct 14 '22 08:10 NKarolak

Disabling code analysis and disabling code actions both do not result in speedup.

FSchneiderYav avatar Oct 14 '22 08:10 FSchneiderYav

Can confirm as well. I am not able to use version 10.0.687650 due to it being incredibly slow.

sigurpallviggo avatar Oct 14 '22 09:10 sigurpallviggo

Could you share a few more details? Some questions:

  1. Is VSCode taking up all the available memory in the last VSIX? Can you share the memory consumption of VSIX when the slowdown is observed?
  2. Is the CPU stuck at 100%?
  3. Does this happen during project startup or is it consistent after the project has fully loaded?
  4. Are there particular scenarios or setups that trigger the slowdown?
  5. Does this happen only in large projects or is it every project size? Can you share a minimal repro if it happens in small projects as well?

BazookaMusic avatar Oct 17 '22 15:10 BazookaMusic

1 - 3-4Gb, not all memory 2 - CPU spikes to 30% after you start typing in something. If app is idle then it goes down to 0% 3 - This is consistent (4-5) - Our project is 1200 files, with 20-50 files project it's not so noticeable

Machine specs: 24 core CPU/ 64Gb RAM

LoanVision avatar Oct 17 '22 15:10 LoanVision

To add, my experience: It also happens for 'smaller' projects with only around 100 .al files/objects. CPU goes to 100% after some time, memory usage is moderately high, but not all memory is being used.

rvanbekkum avatar Oct 17 '22 17:10 rvanbekkum

Two more questions just to ensure we have the correct information:

  1. Could you share your project settings? Are you using incremental build?
  2. Could you ensure that when changing settings, you reload the projects? To try with codeanalysis or other changes disabled, the project needs to be reloaded. This has to be done by either restarting VSCode or using reload window from the VS commands.

BazookaMusic avatar Oct 18 '22 09:10 BazookaMusic

HI Sotiris;

I am developing extensions for Business Central using the AL language, so I don't think the first question relates because there is no incremental build and no project settings other than the launch.json and app.json files, which I can send you if you think they would be useful.

I tried un-installing and re-installing VS code. I also started with a clean checkout of the project I am working on and regenerated the symbols files for AL (AL: Download Symbols). I did not delete my system or personal settings. After re-installing (1.71.2) I observed the same performance issues.

Next I un-installed VS code and then installed the previous release (1.70.2) see the screenshot below for additional details. I experienced some initial problems with this version, but I did not record the details. I was able to resolve any issues I was having with the 1.70.2 branch by deleting all of my User and Workspace settings (%APPDATA%\Code\User\settings.json).

@.***

If there is any other information you need or anything I can do to help please let me know.

From: Sotiris Dragonas @.> Sent: October 18, 2022 2:30 AM To: microsoft/AL @.> Cc: David Aldis @.>; Author @.> Subject: Re: [microsoft/AL] Intellisense is very slow. (Issue #7190)

Two more questions just to ensure we have the correct information:

  1. Could you share your project settings? Are you using incremental build?
  2. Could you ensure that when changing settings, you reload the projects? To try with codeanalysis or other changes disabled, the project needs to be reloaded. This has to be done by either restarting VSCode or using reload window from the VS commands.

Reply to this email directly, view it on GitHubhttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FAL%2Fissues%2F7190%23issuecomment-1282101992&data=05%7C01%7Cdavid%40binarystream.com%7Cbd2cfebac11e4f33306d08dab0eb5ae5%7Cdd24e63d21314bd0bdd5570c473ba440%7C1%7C0%7C638016822152801460%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NDYtlC4%2B02EzTFp27H%2Fd%2FPumnUfdKHiEzTEV7UwOSNI%3D&reserved=0, or unsubscribehttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARBYP557VT5TJ7V5NAH66YDWDZU2FANCNFSM6AAAAAAQ5CD7QY&data=05%7C01%7Cdavid%40binarystream.com%7Cbd2cfebac11e4f33306d08dab0eb5ae5%7Cdd24e63d21314bd0bdd5570c473ba440%7C1%7C0%7C638016822152801460%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=jD3Uw8TR0ADwnTweonz1E%2BOHtz21Fh1Vf%2B3KPdcjkJU%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.@.>>

davidatbinarystream avatar Oct 18 '22 17:10 davidatbinarystream

Answers inline below...

From: Sotiris Dragonas @.> Sent: October 17, 2022 8:50 AM To: microsoft/AL @.> Cc: David Aldis @.>; Author @.> Subject: Re: [microsoft/AL] Intellisense is very slow. (Issue #7190)

Could you share a few more details? Some questions:

  1. Is VSCode taking up all the available memory in the last VSIX? Can you share the memory consumption of VSIX when the slowdown is observed? DA: No, memory usage was around 40% - 50% which is normal for my system.
  2. Is the CPU stuck at 100%? DA: No, CPU usage specifically for VS Code was about 20% - 30%, other process added less than 10%.
  3. Does this happen during project startup or is it consistent after the project has fully loaded? DA: Performance issues remain consistent throughout usage.
  4. Are there particular scenarios or setups that trigger the slowdown? DA: I did not notice any specific scenarios that caused a difference. I am only writing extensions for Business Central using the AL language, so perhaps there are specific issues with that language?

Reply to this email directly, view it on GitHubhttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FAL%2Fissues%2F7190%23issuecomment-1281088469&data=05%7C01%7Cdavid%40binarystream.com%7C220a5faef0d24d01f57408dab057479f%7Cdd24e63d21314bd0bdd5570c473ba440%7C1%7C0%7C638016186194448747%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=axdgCQqTjlr%2F3gwQQu82RhU1vRmMEKVm%2F48TPpu9XuM%3D&reserved=0, or unsubscribehttps://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARBYP56XGS33TLMPP4CPJ4DWDVYTLANCNFSM6AAAAAAQ5CD7QY&data=05%7C01%7Cdavid%40binarystream.com%7C220a5faef0d24d01f57408dab057479f%7Cdd24e63d21314bd0bdd5570c473ba440%7C1%7C0%7C638016186194448747%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qMV5K62vEr58jZ%2BpvPjPbOmgXQfO1ynpVnyt7BSYw%2B0%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.@.>>

davidatbinarystream avatar Oct 18 '22 17:10 davidatbinarystream

@BazookaMusic

Yes there is a difference when enabling CodeAnalysis, but even deactivated the new version is far slower and opening for instance the Microsoft Base Application Source files which you could also try is taking significant longer. And navigating in the source files takes longer and the CPU usage is higher, I would say roughly about a half more. With navigation I speak of Go to Defintion, Find All References and so on.

When using code analysis I used all 4 analysers in this test activated simultaniously.

The sub process Microsoft.Dynamics.Nav.EditorServices.Host from VS Code was the one using the CPU and memory. I hope this information helps you identifying the problem

BernhardKloibmueller avatar Oct 19 '22 07:10 BernhardKloibmueller

FWIW: this also happens in macOS.

Our whole team (both Windows and macOS developers) has been suffering from this bug since we upgraded the v10 of the AL extension. We've also had to downgrade to v9 for now (thankfully we were not yet targeting BC21), because VS Code was nearly unusable.

salgiza avatar Oct 20 '22 12:10 salgiza

May or may not be related:

Our product development is seeing no issues, all on latest AL and working against BC21 since mid-October now. Preview Versions and later GA versions used. Very large workspace. At the same time we have internal issues being opened by project teams experiencing just what is described here. Much smaller workspace, of course.

At the same time I have observed dramatically longer pipeline runs, as soon as we load dependency packages for compilation, that are runtime packages. Opposed to that loading the same as app packages leads to 10% of the compile time. So: load libs as runtimes = looong compile, load libs plain app packages = normal compile time.

Looking at pipeline logs from before AL 10, it appears that using runtimes did not increase the compile time anywhere that dramatically.

So, maybe: issue with symbols loaded from runtimes or runtimes used directly in local packages folder? (In troubleshooting process on our side, don't know yet)

RafaelKoch avatar Oct 21 '22 07:10 RafaelKoch

I've been investigating this issue by using the Base Application as a reference and unfortunately it's not trivial to reproduce on my machine. The findings I have until now are:

  1. Analyzers make a huge difference in performance, even in small projects. I would definitely suggest not running with background code analysis on large projects because the current implementation saturates resources and can make everything slower. This can be tweaked by setting "al.backgroundCodeAnalysis": false in the "settings.json" file of your project (.vscode folder).
  2. We identified a bug where just opening a file in VSCode would trigger a re-compilation of the entire project. This may explain why in large workspaces everything becomes slow because just navigating to different files will force a background compilation. Combined with analyzers, this can tank performance.
  3. Using the base application with our default project settings, does not reproduce the problem on my end.

It would be very helpful if you could provide us with a few helpful artifacts so we can see what's happening on your specific machines. Here's a few things that would be very useful:

Can be shared in github:

  1. Settings.json: Your settings.json file from your project. If it is not there, the global one you are using from (%APPDATA%\Code\User\settings.json). Try enabling '"al.incrementalBuild": true' and see if that makes a difference.

  2. In settings.json, set "al.editorServicesLogLevel" to "Verbose" and run your scenarios. You can find the produced log in: C:\Users.vscode\extensions\ms-dynamics-smb.al-\bin\win32 The log grows fast so it would be good to reproduce a short scenario.

  3. The target runtime version of your projects from app.json

The items below must be sent privately: In order of usefulness:

  1. Ideally an AL project that would reproduce the issue

  2. A cpu trace of the process while trying your scenarios. Here's how you can get that: Download perfview.exe from the official link: https://github.com/Microsoft/perfview/releases Open perfview.exe and click Collect->Collect at the top bar. In the popup window, set circular MB to be something like 1000MB (the size of the trace) and click collect. The tool will start collecting stack traces. image

Then you can use VSCode to reproduce the scenarios.

  1. A memory dump of the editor services process. To do that, open task manager and find the vscode process. Expand it to see the Microsoft.Dynamics.Nav.EditorServices.Host process. image

To send the private files, I would suggest uploading them to a onedrive account (due to their size) and sending me a private message on Yammer (my name is on my github profile).

BazookaMusic avatar Oct 21 '22 10:10 BazookaMusic

Ok, this is a bit silly because I posted my comment not even 24 hours ago but... in our case, the problem seems to have been fixed in yesterday's update (v10.0.687650).

salgiza avatar Oct 21 '22 11:10 salgiza

@salgiza Which new version are you referring to ...? image

NKarolak avatar Oct 21 '22 11:10 NKarolak

@NKarolak Ok, this is really weird but...

CleanShot 2022-10-21 at 14 37 35

I've been playing with it, and it seems like VS Code shows the last date you updated/installed the extension, instead of the last date the extension was updated (as it does the same date in the VS Marketplace).

I trusted the date when I saw it this morning, and I thought that it was a new version...

But this makes the bug even weirder. Why did the extension behave correctly today after two weeks of awful performance? 🤔 (Same computer, same project, for me and a coworker I told to update today after I did) Maybe we opened fewer files? (Thinking of the bug that @BazookaMusic mentioned).

Oh well, we'll see what happens on Monday...

salgiza avatar Oct 21 '22 12:10 salgiza

I can confirm that performance has tanked significantly with v10. Going back to 9 works great, but then I don't get the new warnings. Turning off background code analysis works, but then I have to wait on a build to get most of my diagnostics. Disabling faulty rules like AA0241 helps reduce the nice and load, but it doesn't solve it.

mjmatthiesen avatar Oct 21 '22 20:10 mjmatthiesen

Guys, with all respect to what you do - this needs to be fixed ASAP. Can we get a status when this will be fixed or what can be temporary fix apart from using old extension? Surely when you open your base app you will see huge lag/slowness. Is there any ETA?

Thank you.

LoanVision avatar Nov 01 '22 23:11 LoanVision

@LoanVision Unfortunately, we don't see this slowness in BaseApp and we have not had any complaints from engineers working on about a performance degradation, so we have no leads to investigate. As mentioned earlier in this thread, there's even large third-party projects which are not experiencing this performance slowdown.

I have compared the performance of previous version and the current version on the BaseApp (multiple versions of baseapp from 19 to 21) and other projects and was not able to reproduce the slowness. I have also compared the performance of analyzers from previous versions with those of the current version and there's no obvious performance difference.

In my previous message, I provided a few ways that you can provide help by giving us profiler traces or logs of what is happening on your machines. It is possible that the specific structure of the projects is causing compilation to take longer.

I still haven't received any of these debugging resources from anyone. If nobody provides these, fixing this is a shot in the dark, thus we will close this issue and promise to improve the general performance.

In the meantime, I am waiting for someone to reach out to provide these resources and investigating on general performance improvements, which are not guaranteed to solve the issue because again, we can't reproduce it.

BazookaMusic avatar Nov 02 '22 13:11 BazookaMusic

@BazookaMusic

Sorry I did not see your request.

Then I will provide as much as possible. Due to proper comparison I used the Base Application OnPrem 20.4 Secondly I used a small PTE.

The first thin I noticed is that the size of the log of an the compiler V10 is doubled the size for the same action.

The following Actions were made by me:

Base Application: Opening the folder and openening the file AADApplication.Table.al My PTE: Openend a Codeunit and adding a procedure saving it and deleting the procedure and saving it.

Unfortunately openening the Base Application will create a 154MB file in Version 9.5 and a 306MB file in Version 10. So no upload is possible. grafik

So I can only send you my small PTE: Version 9.5: _ForGitHub_9.5_EditorServices_ContiniaInteg_Open_NewProcedure.log Version10: _ForGitHub_10_EditorServices_Continia_Open_NewProcedure.log

Settings.json: _ForGitHub_settings.txt App.json _ForGitHub_app.txt

I have everything set up and additional extensions activated just like in my projects. Maybe some of them is the issue I will get again in touch with you.

I will try to reproduce this with tracefiles and so on but even reproducing this in a clean environment takes time for us so please also consider this that we maybe from your point of view lazy and not giving you enough information to investigate. Also I will repro everything again when I am able to remove unnecessary extensions.

BernhardKloibmueller avatar Nov 02 '22 14:11 BernhardKloibmueller