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

Initialization of extension is very slow for large projects #757

Open
1 task done
plevold opened this issue Nov 22, 2022 · 4 comments
Open
1 task done

Initialization of extension is very slow for large projects #757

plevold opened this issue Nov 22, 2022 · 4 comments
Labels

Comments

@plevold
Copy link

plevold commented Nov 22, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Description

Not really a bug and not really a feature, but more of an annoyance. In a somewhat recent update of Modern Fortran the extension started to have fortls(?) analyze all Fortran files each time a folder is opened. Fortls functionality is not available until this has been completed and for large projects this takes a very long time. See screencast below.

Screenshots

Animation

Expected Behaviour

Analyzing all source files is probably the right thing to do, but with the current performance I think it takes too long until fortls features are available. I would assume that in many situations, a large number of the files are actually unchanged since last time VSCode started. Maybe it would be possible to speed up the initialization by serializing the fortls data structure once initialized and then deserialize it the next time VSCode starts? This would require keeping track of which files has changed e.g. with modification timestamps or a hash of the content though.

Version of Modern Fortran

v3.4.2022112202

Version of Visual Studio Code

v1.73.1

Platform and Architecture

Linux

Additional Information

No response

@plevold plevold added the bug label Nov 22, 2022
@gnikit
Copy link
Member

gnikit commented Nov 22, 2022

So what you're seeing there is an experimental initialisation process I added a while back that basically tries to generate all the .mod/.smod files for your linter. You should be able to disable this behaviour with fortran.linter.initialize set to false.

The only thing that really needs to happen is to figure out the dependency graph (what fpm does) and pass that to the linter. The problem is that fpm cannot be easily installed on systems + it's lacking this functionality currently.
For

  1. see: FPM pip installation fpm#705
  2. see: FPM Integration with Visual Studio Code - Discussion fpm#768 point 3.1

Serialising the dependency graph might be a good idea, but then you also have to take care of validating the cache's state which is not trivial.

@gnikit
Copy link
Member

gnikit commented Nov 22, 2022

In general, the tools to do this exist. Either fortls, fpm or some other Python package, the problem is that they need a bit of polishing to accomplish this and more importantly I don't have much free time for this. I will see if I can squeeze some of that stuff into another proposal but for now I think attention is diverted to STF projects.

@plevold
Copy link
Author

plevold commented Nov 22, 2022

I see! When I turned off fortran.linter.initialize then the extension started quickly again 👍 I don't use any compiler linting (only fortls) for the moment so that works fine for me.

@gnikit
Copy link
Member

gnikit commented Nov 22, 2022

Happy that worked out. BTW the initialisation stuff will be disabled by default in the official release. Same as the options under experimental. I have them on in the pre-release for users to give feedback. So thanks for taking the time to give feedback. I really appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants