-
Notifications
You must be signed in to change notification settings - Fork 55
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
Too many parsing requests for the active file on every edit/focus. #492
Comments
At least some of the additional parsing is expected: during calculating completion suggestions we insert fake identifiers that allow us to get reparsed nodes as if there was a name typed in already, and it helps a lot and needed for many of completion features. These requests are not expected to be cached anywhere or to influence the project caches and it was the reason I added the
This one looks like a bug if the file is parsed in the context of a project, and not in the sandbox (used in completion and other features). |
With the latest FCS I can see that non-active files are only parsed once after project load and cached correctly. I'm looking at remaining excessive requests.
Are these two requests somehow different in a way I can't see? EDIT: Sorry, I'm being stupid, I didn't dump most of the EDIT2: I made sure to dump all the options, and the two requests are still identical: Request
Code used (added in https://github.com/dotnet/fsharp/blob/90abb7f276b080903978fbbd34e3633c194cc93a/src/Compiler/Service/FSharpCheckerResults.fs#L2420):
|
Slightly orthogonal, but partly driven by the above discrepancy in defines: Typing a single character causes 5 requests (2 Sandbox requests + 3 |
@safesparrow Thanks for your analysis, I'm going to look into it. |
Writing F# in Rider on my M1 is still quite choppy... Even a single file project stutters during typing, tab insertion and reformatting etc. |
@NinoFloris I don't think what you see could be caused by parsing requests reported here, as they have never been seen in the snapshots we've analyzed (unlike some other issues that we've fixed or are trying to fix). Could you please capture a backend performance snapshot and file a separate issue, so we could look into it? |
Parsing can take ~10-20% of time to check files/projects. I think some of the requests are not necessary.
This compounded by lack of parsing caching in FCS means there is a lot of unnecessary work happening all the time in the IDE.
I'm running Rider with a locally built FCS.
I added a breakpoint here: https://github.com/JetBrains/fsharp/blob/35e742b334353de45b11d1d5c4cfecb02e6e58fe/src/Compiler/Driver/ParseAndCheckInputs.fs#L428
and can see that the parsing happens more often than I would expect when editing/focusing on files.
Some extract showing the parsing events.
Every
ParseInput(fileName)
means a single call to the above method.The other lines reflect user actions:
The following is a result of these 3 steps:
let x = 1
It does feel like there are a few too many calls to parse a file. In particular I can see the following issues:
Sandbox.fs
andAssemblyInfo.fsi
.AssemblyInfo.fsi
do not hit the parsing cache. I can see the right entry in the cache, but parsing still occurs - see the screenshot below. This one is probably to be fixed in FCS, but still relevant:More context for 5.:
I found that one of the reasons caching doesn't work is that the two caching keys, while otherwise identical, have a different set of
FSharpParsingOptions.ConditionalDefines
. One of them has these two extra defines:EDITING ; COMPILED
at the top (note thatCOMPILED
also appears at the end of the list in both.Is this set of defines controlled by Rider? If so, could the sets in both calls be aligned?
The text was updated successfully, but these errors were encountered: