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

Provide FSharpEntity.EnclosingEntity #830

Closed
vasily-kirichenko opened this issue Oct 25, 2017 · 4 comments
Closed

Provide FSharpEntity.EnclosingEntity #830

vasily-kirichenko opened this issue Oct 25, 2017 · 4 comments

Comments

@vasily-kirichenko
Copy link
Contributor

vasily-kirichenko commented Oct 25, 2017

In dotnet/fsharp#3803 I do the following:

  • get an open declaration (which is now available as a property in FSharpFileCheckResults and presented as FSharpEntity [])
  • check if any of symbols defined in each of the modules / namespaces above is used in the scope this particular open declaration is open

Currently I call FSharpEntity.MembersFunctionsAndValues for each namespace/module and it's the bottleneck - on middle sized files the analyzer takes several seconds to finish, on TypeChecker.fs it takes ~2 minutes, which is too slow.

So I'm trying to use different approach: get enclosing entity of each symbol uses and check if it corresponds to a module/ns from open declarations, which eliminates calling MembersFunctionsAndValues entirely. Unfortunately, only values, functions and members have EnclosingEntity (that is, modules for my purpose). I need this property for FSharpEntity too.

This approach is indeed a lot faster. Ignoring FSharpEntity and checking only vals and functions via EnclosingEntity processes TypeChecker.fs in 4 seconds, smaller files in tens of milliseconds.

I tried to add this here vasily-kirichenko/visualfsharp@39173f6, but I've completely lost.

EnclosingEntity should contain proper value for both F# and IL types and modules and namespaces (None - for root namespaces).

@dsyme could you please suggest a proper way to add this functionality?

@dsyme
Copy link
Contributor

dsyme commented Oct 25, 2017

Yes, it's not there because of a bit of a flaw in the TAST. I've put it on my TODO list to try to root this problem out. We will need it for other reasons too

@vasily-kirichenko
Copy link
Contributor Author

Thanks a lot!

@dsyme
Copy link
Contributor

dsyme commented Mar 12, 2018

@auduchinok I managed to improve the performance of unused opens dotnet/fsharp#4497 without implementing this. I'd still like to get it implemented though, it would make things simpler and faster

@auduchinok
Copy link
Contributor

auduchinok commented Apr 1, 2018

@dsyme I've checked the new unused opens implementation and it's indeed works much faster on an average solution/files, however getting children of something like JetBrains.Util still looks to take longer than a small file type check. The good news is tweaking unused imports to use the new DeclaredEntity made performance great on this file.

I'm looking into opening a PR with usage of DeclaredEntity, but will try to fix dotnet/fsharp#4658 first.

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

No branches or pull requests

3 participants