-
Notifications
You must be signed in to change notification settings - Fork 833
Faster finding references #14293
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
Faster finding references #14293
Conversation
vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs
Outdated
Show resolved
Hide resolved
|
8Gb worst case looks concerning |
Well worst case performs the same as what we have now. Although identifiers are still being collected even when |
|
I guess there's an extra ~180 MB being allocated, which can be seen even when cache is not emptied. But that still wouldn't be a bad trade-off even if we couldn't get rid of that. |
|
Would be good to calculate and highlight the ratio between old & new results, to make it explicit. As far as I am concerned, this is really great - if we are certain this does have full recall and no missing hits (it is fine to have suboptimal precision, since it is just a heuristics and the precise search still happens) |
|
@T-Gro well the benchmarks are not super representative of real projects. But I might just do some on finding various symbols in FCS project. And yes we'd need to ensure that it doesn't miss anything. Right now it's comparing parsed |
|
This looks like fabulous work! |
|
Thanks @dsyme. What do you think about exposing the identifiers on |
|
Found out it wasn't working for names in backticks, operators and attributes. Fixed those and added tests, looking for other cases where it might fail... |
I think it's worth inserting it with the flag disabled by default and test it on the compiler, as we work on it. And push fixes as we find any issues. wdyt? |
|
I moved the flag from creating |
psfinaki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff, looking forward to have this in VS!
|
Let's merge this, or? |
ca366b9
|
@T-Gro @psfinaki @vzarytovskii please re-review/approve, I addressed the PR comments. |
Finding references can be quite slow because it requires full type checking results. This is probably the main obstacle for a working "rename" functionality in large projects.
My idea is to have a preliminary look at a set of all the identifiers in the file and see if the symbol we're looking for is in the set - and only if it is do the potentially expensive checking to actually find if its referenced.
It's not going to speed up 100% of the cases (like when the symbol is referenced in the very last file, requiring to check everything else anyway, or when you're renaming some identifier like
xwhich you use in a lot of files), but it should speed up a lot of them.When trying this on random symbols from
FSharpsolution in many cases there was quite noticeable (5-10x) speed-up, making renaming and finding references pretty usable. I'm trying to put together some proper benchmarks.How to test this locally
artifacts\VSSetup\ReleaseVisualFSharpDebug.vsixto install it in VSSynthetic benchmarks
Finding all references to a symbol defined in first file. The project has 50 files with 1400 LOC each. There are no other identifiers with the same name as the symbol.
The most interesting cases are best and medium case when the cache is empty (e.g. first file was just edited and invalidated everything.) where we get roughly 20x and 2x speed-up respectively.