richterger / Perl-LanguageServer

Language Server for Perl
Other
219 stars 53 forks source link

How to optimize performance when debugging in VSCode #201

Open parawanderer opened 7 months ago

parawanderer commented 7 months ago

Hello there,

First of all, this is a great extension! This extension has really made the development experience of working on perl code closer to more popular languages, and I greatly appreciate the effort that went into making this extension to make that possible.

My situation is as follows: I'm working on a large perl monorepo over an SSH connection. I got a configuration setup that works for getting the debugger to run, however I'm facing problems when it comes to debugger startup time/timeouts. It appears that the relationship is that the more perl modules get loaded, the slower the experience and the higher the likelihood that a disconnect happens during the process. I also have cases of the debugging never starting at all when I load some modules that are known to themselves be very large -- the debugging log indicates that that is due to a timeout.

I noticed in the "Output" window for the "Perl Language Server" that there's a constant stream of this:

loaded  files, parsed 1000 files, 1000 files
loaded  files, parsed 1100 files, 1100 files
loaded  files, parsed 1200 files, 1200 files
loaded  files, parsed 1300 files, 1300 files
loaded  files, parsed 1400 files, 1400 files
loaded  files, parsed 1500 files, 1500 files
loaded  files, parsed 1600 files, 1600 files
loaded  files, parsed 1700 files, 1700 files
loaded  files, parsed 1800 files, 1800 files
loaded  files, parsed 1900 files, 1900 files
loaded  files, parsed 2000 files, 2000 files
loaded  files, parsed 2100 files, 2100 files
loaded  files, parsed 2200 files, 2200 files
loaded  files, parsed 2300 files, 2300 files
loaded  files, parsed 2400 files, 2400 files
loaded  files, parsed 2500 files, 2500 files
loaded  files, parsed 2600 files, 2600 files

And so on. Now, what I'm doing is that I am opening the very large monorepo at the root in VSCode, and I configured the extension to have perl.perlInc in settings.json set to a large subdirectory from this monorepo. I assume that it's either loading all the files in the opened directory or all the files from the perl.perlInc.

I'd really like to be able to use this extension when working against files that are doing fairly heavy imports, including the ones that are currently timing out, and was wondering if there's any advice on how I could optimize the setup to be more performant (possibly not scan all the files as it is doing now if this is contributing to the poor performance)

Thanks in advance

richterger commented 6 months ago

If you have an issue when starting the debugger, that should not be related to parsing of source files, which is done in the background. What could be the case is, that becasue Perl::LanguageServer parses all these modules (to be able to support goto symbol etc.) it might get very big, so maybe you run out of memory. Could take a look with top how your memory situation is when starting to debug. If it's not an memory issue, please set LogLevel to 2and post the resulting output from the output pane of Perl::LanguageServer here.